Renumbering UIDs and GIDs?

David Kramer david at thekramers.net
Wed May 22 13:13:11 EDT 2002


On Wed, 22 May 2002, Kent Borg wrote:

> Because of some earlier stupidities of mine, I currently have some
> messed up user and group IDs.  I would like to renumber them.  I could
> do some bash-ing to find files with the old numbers and chown them to
> the new, but I would probably make some regrettable mistakes in the
> process.
> 
> This leads me to ask whether anyone knows of an existing script or
> utility that will do this, and has already been debugged?  (I am on a
> RH 7.2 machine.)

> -kb, the Kent is afeared of xargs.

Fear is the enemy of knowledge and productivity.

find / -gid $oldgid | xargs chgrp $newgrp

replacing $oldgrp and $newgrp with the old and new numeric GID's 
respectively.

If you cannot conquer your fears, 

find / -gid $oldgid -exec chgrp $newgrp {} \;

Untested, but 99% sure this will work, or at least not get you arrested.

----------------------------------------------------------------------------
DDDD   David Kramer         david at thekramers.net       http://thekramers.net
DK KD     One last warning: don't believe anything that you read in this
DKK D     document.  Every effort has been made to ensure that this document 
DK KD     is incomplete and inaccurate, and I take no responsibility for an
DDDD      glimmers of correct information that may, by some fluke, be here.
                                                       UW_IMAP documentation




More information about the Discuss mailing list