The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Permissions changed

Discussion in 'General Discussion' started by DrZEUS, Apr 26, 2006.

  1. DrZEUS

    DrZEUS Active Member

    Joined:
    Jan 24, 2004
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    1
    It looks like an account on our server had virtually all files reset to "0" permissions (no permissions) on it's own (at least that's what the account holder says). Is this possible? Is there a quick way to reset the permissions in each folder?
     
  2. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    I'm not entirely sure if a user could do this by mistake or otherwise, but I've certainly had fun in the past making interesting file system mistakes via PHP scripts.

    You should be able to use /scripts/chownpublichtmls to fix the problem.
     
  3. brianoz

    brianoz Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,146
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    Melbourne, Australia
    cPanel Access Level:
    Root Administrator
    Just for interest, "chmod -R 0" could have done that.
     
  4. DrZEUS

    DrZEUS Active Member

    Joined:
    Jan 24, 2004
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    1
    will /scripts/chownpublichtmls change permissions for all accounts on the server? i would rather not mess with permissions on other accounts and keep it within the account in question. Thanks.
     
  5. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    It will do all accounts. To just do that one account, the following should get you most of the way there (depends if you have php scripts running without phpsuexec):

    find /home/username/public_html -type d | xargs chmod -x 755
    find /home/username/public_html -type f | xargs chmod -x 644
    find /home/username/public_html -name *.cgi | xargs chmod -x 755
    find /home/username/public_html -name *.pl | xargs chmod -x 755


    For nobody files, you might need:

    find /home/username/public_html -user nobody | xargs chmod -x 666
     
  6. DrZEUS

    DrZEUS Active Member

    Joined:
    Jan 24, 2004
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    1
    ok now how do i change the the owner permission for www folder from root to the username of the account? public_html has the user persmision set but www does not. I think this is why now after changing the permissions on all the files on the account that no parts of the website can be accessed (You are not authorized to view this page error).
     
  7. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,384
    Likes Received:
    23
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    The www directory should be a symlink to the public_html folder. You may want to make sure that the public_html folder has the correct permissions:

    Code:
    chown username:nobody public_html
    chmod 750 public_html
    Of course, replace username with the actual username of the account.
     
  8. DrZEUS

    DrZEUS Active Member

    Joined:
    Jan 24, 2004
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    1
    nevermind I changed the ownership of the www folder.

    now im getting "could not connect to database" errors for mysql.
     
  9. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,384
    Likes Received:
    23
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    This is a different issue entirely. Make sure the MySQL service is running, and then make sure you are using the correct MySQL username and passwords for your scripts.
     
  10. DrZEUS

    DrZEUS Active Member

    Joined:
    Jan 24, 2004
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    1
    i suspect the issue is related. Last night I manually changed the permissions on many of the files. I was able to access webpages that used mysql (mycoppermine photo gallery for example) which means there were no database errors. I ran the command lines chirpy suggested above and it didnt seem to change all the folders properly. So I manually changed the permissions for all folders and files on the account like I did last night. Now I am getting the could not connect to database errors.
     
  11. DrZEUS

    DrZEUS Active Member

    Joined:
    Jan 24, 2004
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    1
    Here is the error when trying to access phpBB forum page on the affected account website:

    And here is the error when trying to access mycoppermine photo gallery webpage on the same account:

     
  12. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,384
    Likes Received:
    23
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    This sounds like an incorrect MySQL username/password mismatch. It does not look like you are using a MySQL username, but rather the overall account's username (not recommended). If you have changed the password to your account, then the MySQL password would also be updated, you would need to upgrade the script to reflect this change.

    This looks more like a permission problem. It looks like you may have the wrong permission settings for the file at /home/traffic/public_html/mycoppermine/include/init.inc.php . I would double check those permissions.
     
  13. DrZEUS

    DrZEUS Active Member

    Joined:
    Jan 24, 2004
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    1
    looking into the password thing now.

    as far as the file at /home/traffic/public_html/mycoppermine/include/init.inc.php, i've triple checked the permissions and it is set at 644.
     
  14. DrZEUS

    DrZEUS Active Member

    Joined:
    Jan 24, 2004
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    1
    Ok you were correct I had to recode the password in a php file.

    Now all thats left is:

     
  15. DrZEUS

    DrZEUS Active Member

    Joined:
    Jan 24, 2004
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    1
    ok fixed that now too! i checked and I checked and it appears the lack of sleep lately caught up with me. Permissions on a handful of folders were incorrect!

    Thanks all for your suggestions.
     
  16. 1bigguy

    1bigguy Registered

    Joined:
    Aug 22, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Canada
    How and why would files and folders keep getting owned by nobody. I'm very new to this so please bare with me. Everytime I try to upload something to the "www" folder, the folder I uploaded stays "owned" by the account holder for about 1 hour or so and then it automatically gets "re-owned" to nobody or 99 from 32019 I hope this makes sense
     
  17. 1bigguy

    1bigguy Registered

    Joined:
    Aug 22, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Canada
    Am I not explaining right or does no one know what I'm talkin about.
     
  18. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Please stop bumping the thread. If someone wants to reply, they will.
     
  19. brianoz

    brianoz Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,146
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    Melbourne, Australia
    cPanel Access Level:
    Root Administrator
    Folders get owned by nobody probably because you are running Apache (your webserver) as user 'nobody'. They are always created as nobody immediately when Apache runs as nobody.

    I'm not aware of anything that changes ownership of files in Cpanel, I've never seen that. It's unlikely (although possible) that a script on the account is changing ownership at the later point. What makes you think ownership has changed?

    If you're running Apache as the user (ie you have suexec and phpsuexec turned on in WHM) then the cause would have to be a script. I think this is less likely as "nobody" is the default.
     
  20. 1bigguy

    1bigguy Registered

    Joined:
    Aug 22, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Canada
    @ chirpy: Sorry this has been bugging me for awhile and I was anxious to get an answer. Sorry again for the bump.

    @ brianoz: I'm a Senior Moderator at a hosting company so I don't actually run the server but I do take part in some server maintenance. Right now I'm on Hiatus for a month or two but figured it was a good time to brush up on some things.

    Ok let me explain a bit more. I run an SMF forum on my host. When I need to do a modification to a file in that install of SMF I ftp in using Cuteftp pro and download a copy of the file I need to modify. After that I use php designer to edit the file then I upload it back to the server. In Cuteftp pro, when you have it open the 1 window shows the desktop while the other window shows the server. If you scroll to the right of the server window it shows the ownership of the file, which is usually 32019 (I have know idea what the #'s mean) After I modify a file and re-upload it, close my ftp and re-open awhile later the ownership of the file is now 99.

    Once this happens I can`t do anything to the files that I have uploaded. I always have to go back to the host to ask them to re-own my files. I know this is not a problem with SMF at all. As for scripts changing it there is nothing in my account that would do that. I am the only one that has access to that.
     
Loading...

Share This Page