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

Re: NFS Question



On Mon, 24 Apr 2006 16:48:42 -0500
Tim McDonough <tim@mcdonough.net> wrote:

> I have two Linux machines. One (machine B) has /home exported with
> NFS and the other (machine A) mounts it on /mnt/home. No problems
> with seeing files, reading/writing, etc.
> 
> When I'm logged into machine A and look at a directory...
> 
> ls -l /mnt/home
> 
> ...the owner and group for files on machine B are displayed as being 
> owned by users and groups that do not exist on machine B. They show
> up as being owned by users with accounts on machine A.
> 
> I imagine this is because of some internal table that has valid 
> numbers on both machines but which are associated with different 
> names. Is there any way to have the user and group appear correctly?

The names are just the result of looking up the uid/gid with the system
lookup method - controlled with nsswitch.conf (kinda like DNS for
system users instead of IP addresses).  You probably just have local
accounts on both, and the ids conflict / don't map to the same users.
NFS doesn't know about login names, and the new kernel-based server
doesn't seem to support the rpc.ugidd or whatever the translator used to
be called.

The "right" solution comes in two parts.  First, go over both machines
and change "user" uids/gids (probably those greater than 1024) to not
conflict.  You can use find to remap them - say you decide to change
the user joe, who's currently 1024, to be uid 2024:

find / -uid 1024 -exec chown 2024 '{}' \;
usermod -u 2024 joe

Once you've got the uids and gids separated, you'll want a way to keep
usernames in sync.  If you're using NFS, then NIS would probably be the
easiest to set up, but with just two machine, it's probably even easier
to simply make sure that users who exist on both machines with the same
username also have the same uid (similarly with groups).  Decide on a
standard - maybe use 1024-2047 for users on both machines, 2048-3071
for users on A only, and 3072-4095 for users on B only.  Either way,
make sure that users who exist on only one machine don't have the same
uid as users on the other, and ensure that users who exist on both have
the same uid.  Same for groups/gids.

I hope that's clear enough... :)

--Danny

-
To unsubscribe, send email to majordomo@luci.org with
"unsubscribe luci-discuss" in the body.