Hello,
Recently I had to backup my data because the hard drives were failing. When I restored the accounts, all folders (user

in /home had the same owner (a3u3). Here's an example:
Quote:
root@voyager [/home]# ls -al |more
total 12845244
drwxr-xr-x 1099 root root 20480 Jan 21 16:42 ./
drwxr-xr-x 23 root root 4096 Jan 21 16:42 ../
drwx--x--x 7 a3u3 a3u3 4096 Jan 19 08:23 a3u3/
drwx--x--x 7 a3u3 a3u3 4096 Jan 19 08:23 a789crew/
drwx--x--x 7 a3u3 a3u3 4096 Jan 19 08:23 ace88/
drwx--x--x 7 a3u3 a3u3 4096 Jan 19 08:23 adamnic/
drwx--x--x 7 a3u3 a3u3 4096 Jan 19 08:24 adamsand/
drwx--x--x 6 a3u3 a3u3 4096 Jan 19 08:34 adi/
drwx--x--x 7 a3u3 a3u3 4096 Jan 19 08:24 adriana/
drwx--x--x 7 a3u3 a3u3 4096 Jan 19 08:34 adultph/
drwx--x--x 7 a3u3 a3u3 4096 Jan 19 08:24 aeortic/
drwx--x--x 7 a3u3 a3u3 4096 Jan 19 08:24 afclan/
drwx--x--x 9 a3u3 a3u3 4096 Jan 19 08:24 afzal/
|
....and so on.
Can anyone help me a script which will change the ownership of each directory? This is how it's supposed to look like:
Quote:
drwx--x--x 7 a3u3 a3u3 4096 Jan 19 08:23 a3u3/
drwx--x--x 7 a789crew a789crew 4096 Jan 19 08:23 a789crew/
drwx--x--x 7 ace88 ace88 4096 Jan 19 08:23 ace88/
drwx--x--x 7 adamnic adamnic 4096 Jan 19 08:23 adamnic/
drwx--x--x 7 adamsand adamsand 4096 Jan 19 08:24 adamsand/
drwx--x--x 6 adi adi 4096 Jan 19 08:34 adi/
drwx--x--x 7 adriana adriana 4096 Jan 19 08:24 adriana/
|
...and so on.
I guess this should be easy to make for someone who knows scripting....Can anyone help me please? I have over 1000 accounts and doing this manually will take ages.
The script should execute chown -R user.group directory...
Thanks,
Marin