SCIENTIFIC-LINUX-USERS Archives

August 2015

SCIENTIFIC-LINUX-USERS@LISTSERV.FNAL.GOV

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Chris Schanzle <[log in to unmask]>
Reply To:
Chris Schanzle <[log in to unmask]>
Date:
Wed, 19 Aug 2015 09:32:59 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (20 lines)
On 08/19/2015 09:07 AM, David Sommerseth wrote:
> On 19/08/15 14:51, Chris Schanzle wrote:
> [...snip...]
>> >I wouldn't imagine migrating to the new scheme would be*that*  difficult
>> >once you nail down the user, old uid, new uid, change their passwd uid,
>> >then run something like this on all your systems: find PATHS -user
>> >$oldID -exec chown -h $newID {} +
> I've done this a few times.  Basically my routine was:
>
> ---------------------------------------------------------------
>   for d in /home /var /tmp;  # See note below
>   do
>      find $d -uid ${OLD_UID} -exec chown -ch ${NEW_UID} {} \;
>      find $d -gid ${OLD_GID} -exec chgrp -ch ${NEW_GID} {} \;
>   done;

That's fine, but there's no need for the loop -- just put all the paths right after "find".  And by using the + operator, you don't fork chown/chgrp for every file.

If you're changing GID's too, separating out the GID search/reset is a good idea to ensure you get all the GID's (not just those matching a UID and using chown -h ${NEW_UID}:${NEW_GID}, which could result in unexpected GID changes.

ATOM RSS1 RSS2