Mapping UIDS/GIDS between ext3 filesystems

Rick Stevens rstevens at vitalstream.com
Mon Feb 12 18:55:00 UTC 2007


On Sat, 2007-02-10 at 13:29 -0800, Aubrey Barnard wrote:
> All helpful gurus,
> 
> I am transitioning to a new install of Fedora on a personal computer. I
> have two sets of partitions, one for a previous install and one for the
> new install. Both partitions use ext3. What I would like to do is have
> each user on the new install be able to access their files on the previous
> install. I am planning just to put a symlink in their new home directories
> which will point to their old home directories. I want to eventually phase
> out the old home directories and reclaim the disk space used for the old
> installation after the users have had time to copy relevant data and
> adjust to the new installation.
> 
> This is all very straightforward, so what is the problem? The problem is
> that I want to have a different (cleaner) set of UIDS/GIDS on the new
> installation. Is there some way of mapping UIDS/GIDS between mounted
> filesystems so that I can create the new users the way I want and they
> will be able to seamlessly access the old files? I want to preserve the
> old installation as is so I can boot it if need be. This eliminates the
> option of changing all the permissions on the old system to match the new
> UIDS/GIDS.

UIDs and GIDs are assigned at login by whatever authentication mechanism
you use (passwd files, LDAP, Kerberos, whatever) and are system wide,
not filesystem wide.  Without using the "su" or "chgrp" commands, a user
retains the UID and GID that they were assigned at login time.

> Do you have any suggestions for the future, if I want to do a similar
> thing again? Would a different filesystem alleviate this problem or by
> using ACLs instead of unix-style permissions?

ACLs supplement Unix permissions...they do not replace them.

> I am considering copying all the user data on the old installation to the
> new installation, but then I have the social problem of getting the users
> to clean out old junk. Maybe a read-only subdirectory of their home
> directory containing a copy of the old data would work? (This is
> effectively what I am trying to do with creating a symlink to the old
> data.)
> 
> I only have a handful of users to manage so the solution doesn't need to
> be scalable to business proportions.

You can change the ownership and group of files on the old system to
what the new system expects.  By default, RHEL starts assigning normal
user and group IDs starting at 500.  Anything less than that is
considered a "system" account (actually, anything from 0 to 100 is a
true system account...RHEL reserves a 101-499 gap for future expansion).

Set up your new users, get their UID and GIDs, then as root:

	# chown -R NEWUID:NEWGID /path/to/old/content
	# ln -s /path/to/old/content ~USERNAME/OLDSTUFF

> I understand this question might be more appropriately put on the fedora
> lists, but the problem is essentially distribution-independent and this
> list needs some traffic too.

Nah, this list is fine and yes, it is a distribution-agnostic thing.
I've seen the same thing over and over in my 30 years of Unix service.
As far as this list...yeah, Fedora has stolen a lot of our thunder. 
It's OK, however, as FC is the lab rat for RHEL and once installation
issues are sorted out there, when they're rolled into RHEL, we end up
with very few issues.
----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer     rstevens at vitalstream.com -
- VitalStream, Inc.                       http://www.vitalstream.com -
-                                                                    -
-  Any sufficiently advanced technology is indistinguishable from a  -
-                              rigged demo.                          -
----------------------------------------------------------------------




More information about the Redhat-install-list mailing list