Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Sep 2010
    Posts
    4

    Unhappy Chown Nightmare

    I accidentally run chown for a user in the wrong directory. All the system files and cPanel user files now have wrong ownership. Is there a way to run a chown command that will reset all ownerships to the default?

    Any help will be appreciated. Running PHP is SuPHP gives 403 and 500 Internal Server Errors. Currently running PHP as CGI to eliminate the error. I however want to use SuPHP as this is more secure.

    Thanks

  2. #2
    cPanel Product Evangelist Infopro's Avatar
    Join Date
    May 2003
    Location
    Pennsylvania
    Posts
    7,894
    cPanel/Enkompass Access Level

    Root Administrator

    Question

    What directory were you in or was affected?

  3. #3
    Registered User
    Join Date
    Sep 2010
    Posts
    4

    Default Chown Nightmare

    I was in the /home directory

  4. #4
    cPanel Product Evangelist Infopro's Avatar
    Join Date
    May 2003
    Location
    Pennsylvania
    Posts
    7,894
    cPanel/Enkompass Access Level

    Root Administrator

    Lightbulb

    Not sure if this thread will be helpful to you somehow or not:

    http://forums.cpanel.net/f5/big-prob...les-35091.html

  5. #5
    Registered User
    Join Date
    Sep 2010
    Posts
    4

    Smile Chown Nightmare

    This command fixed it. It changed the ownership for each directory to the cPanel user for it.

    for i in `ls /var/cpanel/users`; do chown -R $i:$i /home/$i/public_html/*; done

    Additionally if your permissions are off, this two commands will change perms for all folders to 755 and 644 for all files

    find /home/*/public_html/* -type f -exec chmod 644 {} \;
    find /home/*/public_html/* -type d -exec chmod 755 {} \;

  6. #6
    Member
    Join Date
    Mar 2007
    Posts
    29

    Default

    Quote Originally Posted by samhagin View Post
    I accidentally run chown for a user in the wrong directory. All the system files and cPanel user files now have wrong ownership. Is there a way to run a chown command that will reset all ownerships to the default?

    Any help will be appreciated. Running PHP is SuPHP gives 403 and 500 Internal Server Errors. Currently running PHP as CGI to eliminate the error. I however want to use SuPHP as this is more secure.

    Thanks
    Hello,

    etc folders need user.mail ownership and public_html needs group owner as nobody. So use the following commands to fix the issue.

    for i in `ls /var/cpanel/users`; do chown $i:$i /home/$i -R; done
    for i in `ls /var/cpanel/users`; do chown $i:nobody /home/$i/public_html; done
    for i in `ls /var/cpanel/users`; do chown $i:mail /home/$i/etc -R; done

    Web Hosting Service Provider in India

Similar Threads & Tags
Similar threads

  1. You guys are a nightmare
    By denisdekat09 in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 08-09-2007, 10:23 AM
  2. Apache 2 Nightmare
    By jaymc in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 07-05-2005, 03:30 PM
  3. Webalizer - Nightmare
    By Markwaugh in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 02-18-2004, 05:35 PM
  4. Frontpage nightmare!
    By clook in forum cPanel and WHM Discussions
    Replies: 11
    Last Post: 12-19-2003, 03:14 PM
  5. interchange - nightmare
    By Jessica in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 03-22-2003, 07:34 PM
Tags for this Thread
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube