I need to change the permissions of all files and directories on a Cpanel server.
/home/USER/public_html/ any directory to 750 user:nobody
/home/USER/public_html/ any file to 644 user:user
and all files recursively.
I found this on the forum but I need to be totally sure it is correct first.
cd /home
ls -al|grep root
for i in `ls /var/cpanel/users/`; do chown $i:$i /home/$i ; done
for i in `ls /var/cpanel/users/`; do chown -R $i:$i /home/$i/* ; done
Then run;
for i in `ls /var/cpanel/users/`; do chown $i:nobody /home/$i/public_html ; done
for i in `ls /var/cpanel/users/`; do chmod 750 /home/$i/public_html ; done
Then run;
/scripts/mailperm
chown root.root /home
So to test this:
I setup a folder in the root called /hometwo/
and a folder called /var/cpanel/userstwo/
and copied some test files into both locations.
But I get an error...
Last login: Tue Apr 23 12:21:25 2013 from xxx.xx.xx.xx
[email protected] [~]# cd /hometwo
[email protected] [/hometwo]# for i in `ls /var/cpanel/userstwo/`; do chown $i:$i /hometwo/$i ; done
chown: `./:./': invalid user
chown: `../:../': invalid user
[email protected] [/hometwo]# for i in `ls /var/cpanel/userstwo/`; do chown -R $i:$i /hometwo/$i/* ; done
chown: `./:./': invalid user
chown: `../:../': invalid user
Is this test even feasible?
Will the script work in its normal form?
Really just implementing rather than understanding here.
D
/home/USER/public_html/ any directory to 750 user:nobody
/home/USER/public_html/ any file to 644 user:user
and all files recursively.
I found this on the forum but I need to be totally sure it is correct first.
cd /home
ls -al|grep root
for i in `ls /var/cpanel/users/`; do chown $i:$i /home/$i ; done
for i in `ls /var/cpanel/users/`; do chown -R $i:$i /home/$i/* ; done
Then run;
for i in `ls /var/cpanel/users/`; do chown $i:nobody /home/$i/public_html ; done
for i in `ls /var/cpanel/users/`; do chmod 750 /home/$i/public_html ; done
Then run;
/scripts/mailperm
chown root.root /home
So to test this:
I setup a folder in the root called /hometwo/
and a folder called /var/cpanel/userstwo/
and copied some test files into both locations.
But I get an error...
Last login: Tue Apr 23 12:21:25 2013 from xxx.xx.xx.xx
[email protected] [~]# cd /hometwo
[email protected] [/hometwo]# for i in `ls /var/cpanel/userstwo/`; do chown $i:$i /hometwo/$i ; done
chown: `./:./': invalid user
chown: `../:../': invalid user
[email protected] [/hometwo]# for i in `ls /var/cpanel/userstwo/`; do chown -R $i:$i /hometwo/$i/* ; done
chown: `./:./': invalid user
chown: `../:../': invalid user
Is this test even feasible?
Will the script work in its normal form?
Really just implementing rather than understanding here.
D