Re: nfs client ownership

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

 



On Fri, 2016-07-08 at 13:57 -0400, bruce wrote:
> Simple question, but can't seem to solve it.
> 
> Test nfs server works
> 
> Copy file to the test dir..
> 
> On the master, the test file cat.txt is owned by 'user1'
> 
> I have a user1 on the client box, and I'd like any files copied to the nfs
> to be shown as owned by the 'user1' on the client nfs box..
> 
> I've looked into the mount command, as well as diff articles on the
> fstab/mount process, but can't seem to resolve this.


The supposedly simple solution is to make sure that all users have the
same user and group identification numbers (UID & GID) on both sides of
the connection.  You can, either, ensure that users are created with the
same ID numbers, in the first place, or you can change them after the
fact.

Logout as that user, if you are them.  The rest will need to be done as
root, and could cause odd behaviour if you change the details of a user
that is logged in.

You can do a "ls -n /home" to get a quick look at who has what numbers.

Edit the /etc/passwd and /etc/group files, so that user and group
numbers are the same for the same username and groupname, on one or both
sides of the connection.

Then "chown -r <username>:<groupname> /home/<username>" (substituting
the <variables> for actual names), so that the user continues to own
their files (remember, the name is only what you log-on with, ownership
is actually done by the numbers).

Now, when the user works with files, either side of the NFS connection,
they own them.  Likewise for any other user.  While it may be tempting
to squash all users to the same NFS user, and have everything owned
anonymously, that will cause problems when a file does need to be owned
by the particular user.

The alternatives are to learn how user ID mapping works (and that
feature wasn't available when I first had to deal with this problem, so
I've never gone down that route), or to use another file transfer
protocol (than NFS) that makes use of usernames rather than numerical
IDs.

Having said that, I did try Samba in the dim and distant past, and
(apart from being miles slower to send files in one direction), did
require you to set up usernames with Samba, for every user that wanted
to use it.

All in all, it seems easier to ensure that all users have the same ID
numbers on all systems that they use and work with.  Though I'd hate to
have to deal with users who come and go, and use other networks.  They'd
be hard-pressed to apply this solution to more than one network.

-- 
tim@localhost ~]$ uname -rsvp

Linux 3.19.8-100.fc20.i686 #1 SMP Tue May 12 17:42:35 UTC 2015 i686

All mail to my mailbox is automatically deleted, there is no point trying
to privately email me, I will only read messages posted to the public lists.

George Orwell's '1984' was supposed to be a warning against tyranny, not
a set of instructions for supposedly democratic governments.
--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://lists.fedoraproject.org/admin/lists/users@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux