SUMMARY: How to change ownership of files after recreating user w ith a different UID #?

From: Notari, Ed <NotariE_at_usa.redcross.org>
Date: Tue, 27 Jul 1999 09:50:57 -0400

WOW!!!

If I didn't know any better I'd say you guys were responding before I hit
the send button!!!

Methods to do a chown - to change ALL 102's to new USERNAME;

find / -user 102 -exec chown 201 {} \; -print <- WORKED GREAT !!!
find / -user 102 | xargs chown 201
root_at_yourhost# find / -inum 102 -exec chown 201 {} \;
find / -inum 102 -exec \chown userid:groupid { } \;

Methods to clean up passwd;

"As far as claening up the passwd file, you should be able to use vipw to
edit
and delete the offending line. Actually, I usually just use vi myself."

"Assuming you are not using C2. Edit /etc/passwd with 'vi' and rehash the
password file with '/usr/sbin/mkpasswd /etc/passwd'."

Most insightful comment...

"Maybe I'm missing something, but why don't you just use vipw to edit the
password file, change his UID to 102, revisit his home directory and
change those files and dir's back to 102 and be done with it?"

Actually, this would have been the way to go if our unfortunate user hadn't
been diligently working away for the last few days after the incident
creating and modifying files about the system.


Thanks to...
Jonathan Burelbach [jburelba_at_topaz.cit.nih.gov]
Arnaud.VERON_at_caramail.com
John P Speno [speno_at_isc.upenn.edu]
Wilson, Chris [Chris.Wilson_at_acco-uk.co.uk]
Andy J Betteridge [Andy.J.Betteridge_at_Cummins.com]
Trevor Stott [trevor.stott_at_sheridanc.on.ca]
Christian Biache [Christian.Biache_at_fr.airsysatm.thomson-csf.com]
George Guethlein [gguethlein_at_giantofmaryland.com]
Burch Seymour RTPS [bseymour_at_ns.encore.com]

And many many others...




-----Original Message-----
Hello managers,

First off, I screwed up!

I mistakenly deleted a users account and the files in his "home" directory.
After recreating his account with dxaccounts I restored his files from the
previous days backup. Unfortunately when recreating his account I failed to
look through the passwd file and get his previous UID # (102), instead I let
dxaccounts choose the next UID (201).

The problem is that this user has files all over the system (rightly so in
my case) and all of them are owned by "102". For his "home" directory it
was easy enough to do a recursive chown with his username to reset the UID#.
My question is how do I do the same through out the system? It does not
appear that chown has this capability. Also, I would like to clean up the
passwd file to remove the 102 entry, what would be the best way to do this
and in what order given, the first problem?

Thanks in advance for any and all help!

Ed Notari
notarie_at_usa.redcross.org
Received on Tue Jul 27 1999 - 13:53:07 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:39 NZDT