ownership problems after restore

persiasoft

Active Member
Nov 15, 2004
29
0
151
we have migrated to another server , after restoring accounts, all the ownerships and permissions were missed , like this :

drwxrwx--- 6 32330 mail 4096 Nov 23 12:03 ./
drwx--x--x 10 32330 342 4096 Mar 9 14:41 ../
drwxrwxrwx 2 32330 342 4096 Mar 5 18:38 cur/
-rwxrwxrwx 1 32330 mail 2070 Nov 23 12:03 inbox*
drwxrwxrwx 4 32330 mail 4096 Sep 26 08:21 root.acc/
drwxrwxrwx 2 32330 342 4096 Mar 5 18:37 new/
drwxrwxrwx 2 32330 342 4096 Mar 5 18:37 tmp/

how to chown all /home/users to their users ? 1600 accounts . . . its very difficault to run chown command for every user . . . cause 1600 accounts hosted on this server !
is there any way to fix this problem ?
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,465
30
473
Go on, have a guess
Modified version of code originally submitted by dgbaker:
Code:
for CPAccess in `ls -A /var/cpanel/users`; do chown -R $CPAccess:$CPAccess /home/$CPAccess; done
for CPAccess in `ls -A /var/cpanel/users`; do chown -R $CPAccess:mail /home/$CPAccess/etc /home/$CPAccess/mail; done
for CPAccess in `ls -A /var/cpanel/users`; do chown -R $CPAccess:nobody /home/$CPAccess/public_html; done
Then , to be sure, run:

/scripts/chownpublichtmls