Correct Ownership of all CPanel users

Ideal place for discussions related to Linux/Windows server security, Apache, MySQL, MS SQL and PHP, including tutorials and questions.
hr-ethadmin
Site Admin
Posts: 67
Joined: Fri May 31, 2013 1:04 pm

Correct Ownership of all CPanel users

Postby hr-ethadmin » Sat Jun 01, 2013 11:13 am

Using following script, We can set correct ownership to all users

for i in `cat /etc/trueuserdomains | awk '{print $2}'`
do
chown $i.$i /home/$i -R;
chown $i.mail /home/$i/etc -R;
hown $i.nobody /home/$i/public_html;
done;

hr-ethadmin
Site Admin
Posts: 67
Joined: Fri May 31, 2013 1:04 pm

Re: Correct Ownership of all CPanel users

Postby hr-ethadmin » Sat Jun 01, 2013 11:15 am

cPanel – Fix Ownership of /home/user

echo -e "Checking ownership of /home/user \n"
for i in `ls /var/cpanel/users/`
do
if [ "$i" != "root" ]; then
chown -R $i:$i /home/$i
chown $i:nobody /home/$i/public_html /home/$i/.htpasswds
chown $i:mail /home/$i/etc /home/$i/etc/*/shadow /home/$i/etc/*/passwd
echo $i
fi
done


Return to “System Security”

Who is online

Users browsing this forum: No registered users and 2 guests