[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [SAGE] Looking for reuse: Script to change users UID, change group GID & re-permission files on large scale



On Wed, Jan 19, 2005 at 08:15:02AM -0500, Allan West wrote:
> Steve Simmons wrote:
>>On Tue, Jan 18, 2005 at 01:33:01PM -0800, Carlson, Scott wrote:


>>> We've created an opportunity (!!) within my company here that I need to
>>> renumber (read UID and GID's) approximately 3000 UNIX accounts across 2000
>>> aix/solaris/redhat machines.
>>> Rather then spend time writing sets of scripts to do this, or worry if I 
>>> got my find parameters right, I'm hoping that someone out there will 
>>> have this exact thing sitting in their script repository.  Anyone care 
>>> to share anything that has worked miracles for them when they've renumbered 
>>> accounts in this manner?

 I wrote such a script long ago, but I fear it wasn't terribly
 generalized and I've long since thrown it away.

 I remember that it did handle any SUID/SGID files correctly (saving
 the mode first, and then restoring them); though it also emitted
 warnings about them (since such user executables are worth
 investigation).  Remember that chown strips the SUID bit from files
 on many systems!

 Of than that it was designed to find a suitable number of unused UIDs
 (starting at some offset) and move everyone and all their files to it.

 I tried to make it reasonably efficient, but still need to do it
 in two passes (the first pass to get all the UIDs into a high range
 and the other to move them back down to the 100+ range --- not
 necessary for any technical reason but its what my boss wanted).

 As I recall it was further complicated by the need to merge in the
 accounts of a newly acquired company, detecting any name conflicts
 and resolving those, too.  Sort of dizzying, when you have both name
 and UID overlaps; so we did the first UID remap of "them", then the
 name collision resolution (forcing name changes among "them" in
 most cases) then the merge (having ensured no overlap/collision among
 names nor UIDs) and finally the last UID remap.

 Luckily it was only a small number of servers!


-- 
Jim Dennis