Bob Miller ([EMAIL PROTECTED]) wrote:
>
>Bob Crandell wrote:
>
>> I'm trying to rescue a guy's server.  It has a couple of hundred
>> accounts on it.  I ran this script from kbob:
>
>Yeah, sure, now it's MY fault! (-:
Now is your chance to take the blame.  Don't pass it up.

>
>> (cd $; /bin/tar cvf - .) | (cd $; /bin/tar xvfp -)
>
>Maybe you weren't root when you ran it?
I was.  I didn't realize it didn't change the permissions as it goes.  It waits
until it's all through then does it all at once.

>
>A terser way to do that is this.
>
>       # cp -a $SOURCE $DESTIN
>
>I didn't know about -a until recently.  It wasn't in the cp command
>long ago.
>
>> 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?
>
>perl -F: -nae 'print "find $F[5] -exec chown $F[2]:$F[3]\"{}\"\";\"\n" if $F[5] =~
m./home/.' /etc/passwd | sh -x
>
>Is that dirty enough for you?  (-:  I strongly suggest running it
>without the "| sh -x" part on the end so you see what it's going to
>do, then add "| sh -x" to actually do it.
>
>The comand uses perl to search through /etc/passwd.  For each line
>in passwd, if the user's home directory starts with /home/, then
>it creates this command:
>
>       find HOMEDIR -exec chown UID:GID "{}" ";'
>
>(where HOMEDIR, UID and GID are taken from the passwd entry.)
>
>The perl script just prints those find commands.  Passing them
>to a shell executes them.  The find command executes "chown UID:GID file"
>on every file in the directory tree.
>
>You'll want to check /home for special accounts like /home/ftp or
>/home/httpd where the user shouldn't own the files in the directory
>
>> The other Bob
>
>I guess that makes me the Other Other Bob.  Do we have any other
>Other Other Bobs on this list?
No, I thought you were THE Bob.  You know, "The great and powerful ..."  Do you
prefer butter or margine?


>
>[EMAIL PROTECTED]
>http://mailman.efn.org/cgi-bin/listinfo/eug-lug
>

--
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

Reply via email to