Rich Freeman on 7 May 2013 12:31:11 -0700


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

Re: [PLUG] Moving user accounts


On Tue, May 7, 2013 at 3:03 PM, Eric H. Johnson <ejohnson@camalytics.com> wrote:
> Can I just copy the home folder, etc/passwd, etc/shadow, etc. or
> will I run into problems if I do not regenerate the uids and gids.

If your IDs/usernames/groupnames do not overlap (unlikely with how
most distros manage these), then you can do exactly that and there are
no issues (assuming you don't want to merge any accounts).  Those
files are just text files - you can merge them like any text file, and
cp -a or otherwise copy the filesystems (preserving all metadata).

If they do overlap, then you need to renumber the IDs and rename the
names.  I'd look for a UID/GID-renumbering utility - I'm sure there
are some out there.  Usually you'll want to do this when nobody
affected is using the system.  Once you've renumbered one of the two
systems, then they can be merged.  Renaming accounts is easy - just
rename the home directories and edit passwd/shadow.  Changing the IDs
requires finding all files owned by those IDs and chowning them to the
new ID.

If you do have common accounts across the systems, then map them to
the same UID, and delete the duplicate passwd/shadow entries.  I
probably wouldn't just merge the home directories though - you'll run
into a million conflicts - I'd stick one directory in a subdir of the
other or something.

Rich
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug