Results 1 to 4 of 4

Thread: Setting write permissions

  1. #1
    Join Date
    Feb 2007
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Setting write permissions

    I've just switched to a new server (GoDaddy) and I now have an issue with files that are created through the website. Users will go into a form and that data will be saved into a csv file. The server saves the file as rw-r--r--.

    I've tried adding this line (with and without the quotes) in my php script when the file is processed. It doesn't seem to do anything.

    chmod("$changeFile", 0666);

    The files that are created are giving the group/username of apache. The rest of the files have a different default name.

    Basically, I need a way to automatically set the write permissions of the files when they're created so they can later be edited/deleted.

    I've searched for scripts to do this, but none seem to be effective. The fault is probably mine more than the scripts, this just isn't an area where I have a lot of background.

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Is the server a Windows or Linux server? If the first, I have noticed that you will not really be able to change the permissions of any files/folders on the server; however, you are still able to write to them if they are the same usergroup as the script being ran. If the latter, you should be able to do what you have posted above (the chmod part) if the script and the file are owned by the same user/group.

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    Feb 2007
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by thetestingsite View Post
    Is the server a Windows or Linux server? If the first, I have noticed that you will not really be able to change the permissions of any files/folders on the server; however, you are still able to write to them if they are the same usergroup as the script being ran. If the latter, you should be able to do what you have posted above (the chmod part) if the script and the file are owned by the same user/group.

    Hope this helps.
    It does. But it raises another question. How do I change who the file is owned by. The script is owned by "girlscouts." The file being created is owned by "apache." The easiest solution would be to change the owner of the new file, but I can't see an easy way to do that. Is there a command to change owners when you're not that owner?

  4. #4
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    You could use chown to change the owner (I believe it would work)

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •