Thursday 26 June 2014

Changing multiple account ownerships via SSH

How to change the ownership of multiple accounts under /home via SSH? The option in WHM is a bit tedious.


Solution :


To change the ownership of all accounts to the respective user.user :


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 change the ownership of the individual public_htmls to their respective user.nobody:


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


Change the permissions for public_htmls to 750:


for i in `ls /var/cpanel/users/`; do chmod 750 /home/$i/public_html ; done


Fix the permissions for mail to work fine:


/scripts/mailperm


Fix the ownership of /home:


chown root.root /home



Changing multiple account ownerships via SSH

No comments:

Post a Comment