Assuming the USERNAME in /home/USERNAME is the same as the username in the 
password file, something like:

cd to /home

then:

for i in `ls` ;do chown -R  $i.$i  $i; done

I think that would work.  It *should* take every directory entry, and make 
it owned by the user.
The chown command can take:  user.group   to reset the owner & group of 
the directory.  Some version of redhat use username for the group.  If 
everyone is the member of 'staf' group for example, you could this 
instead:

for i in `ls` ;do chown -R  $i.staff  $i; done

Warning.   This *will* go horribly wrong if in any other directory other 
than /home

On second thought, don't do this.   Someone probably has a better way of 
doing it. (disclaimer)

Around Thu,Oct 16 2003, at 07:33,  Bob Crandell, wrote:
>Hi,
>
>I'm trying to rescue a guy's server.  It has a couple of hundred accounts on it.  I
>ran this script from kbob:
>(cd ${SOURCE}; /bin/tar cvf - .) | (cd ${DESTIN}; /bin/tar xvfp -)
>
>It isn't keeping the ownership of the source.  Can someone come up with a quick and
>dirty way of reading /etc/passwd and assiging the original permissions to
>/home/$USER ?  Please?  There are a hand full of groups but I can reset that as it
>becomes an issue.  That is unless setting the group permission is easy too.
>
>Oh yes, this is Redhat 6.1
>Thanks
>
>The other Bob
>
>--
>Assured Computing
>When you need to be sure.
>[EMAIL PROTECTED]
>www.assuredcomp.com
>Voice - 541-868-0331
>FAX - 541-463-1627
>Eugene, Oregon
>
>
>_______________________________________________
>EuG-LUG mailing list
>[EMAIL PROTECTED]
>http://mailman.efn.org/cgi-bin/listinfo/eug-lug
>

-- 
Roger
---------------------------------------------------------------------------
[EMAIL PROTECTED]
If you can't learn to do it well, learn to enjoy doing it badly.
_______________________________________________
EuG-LUG mailing list
[EMAIL PROTECTED]
http://mailman.efn.org/cgi-bin/listinfo/eug-lug

Reply via email to