We help IT Professionals succeed at work.

NFS mount with different uid

obg
obg asked
on
Medium Priority
3,647 Views
Last Modified: 2012-05-04
Is it possible to mount a nfs share, using another user id? I actually want to mount two nfs shares (on the same server) with different user ids, and I haven't got a clue about how to work this rsync, NIS, etc...
Comment
Watch Question

Commented:
Try the  'user' option of the mount command. Try to take a look in the fstab  man page, it will tell you how you should configure your /etc/fstab to make this work. Try:

man 8 mount

and:

man 5 fstab
CERTIFIED EXPERT
Commented:
NFS mounts are always hosts based. Mounts are done as root.
The user option in /etc/fstab just indicates that the mount can be initiated by another user, but the mount is done as root anyway (/bin/mount is owned by root and has SUID bit set).
obg

Author

Commented:
Well, that parts that is not greek to me is not very hard to find in the man pages. What about this SUID stuff. I have no idea what that is.

What's the problem? Do you need more points, or what? Well, I'll double it because I really need an answer.

Now, where do I specify the username/id and password I want to use for the two different connections? Each time I try mounting, I end up with RPC timeout... It's easy to mount the nfs share from Reflection (or other nfs clients) in windoze, and that is very annoying.
CERTIFIED EXPERT

Commented:
somebody complained about the points?
SUID means that  /bin/mount is always ever run with permissions of the owner of the file, see  ls -l /bin/mount.

> .. where do I specify the username/id and password ..
You cannot. It's host-based (still said this).
I'm not shure about NFS clients on windoze (like Reflection, PCNFS, etc.), probably they manage to make user-based mounts, but that simply 'cause there is only one single user at a time. The mount is identified by the host anyway.
obg

Author

Commented:
Ok. It can be done, since windoze can. You don't mean to tell me that some network related stuff can be done in windoze, but NOT in Linux, do you...?

About this SUID stuff, again: Sorry for being stupid, but what about the /bin/mount owner permissions? What will they reflect? It has an 's' where the 'x' used to be... What does that mean?

You keep telling me that nfs is "host-based"... Which computer is host in this case? I assume that this means that I have to have identical users (with same uid/gid and password) on both machines, and perform the mount with that user...?

Then again, if I can do that, why can't I have two users doing that?
CERTIFIED EXPERT

Commented:
> .. tuff can be done in windoze, but NOT in Linux, do you...?
I do. Reread my previous comment please.

> It has an 's' where the 'x' used to be... What does that mean?
SUID.
The program will be executed with permissions of the owner of this program and not with the permissions of the user caling this program (still saud this).

> Which computer is host in this case?
The client (NFS-client, the machine which does the mount).

> .. that I have to have identical users (with same uid/gid and password) on both machines ..
No. It's host-based (not shure about Reflection). Dot.
What kind of OS are these machines, Windowze? Then you probably have installed the programs in the user's programs directory.

How can you mount the same resource with 2 or more different users from the same Windoze machine at the same time?
obg

Author

Commented:
ahoffman, thanks for your patience. I am not as experienced with low-level linux details as I would like to be. I think I understand most of what you say now (finally). If, as you say, the nfs system is host based, how does the host authenticate itself?

As for my system, I try to stay away from M$... The server (nfs) is a HP/hpux that has the /home directory shared for nfs. I am trying to use an ordinary linux PC as client. With win/Reflection nfs clients, I can map nfs shares just like I map any other network shares. The difference is that the mapping requires user/password (but actually the other mappings do that as well).
CERTIFIED EXPERT

Commented:
> .. an ordinary linux PC as client. With win/Reflection nfs clients ..

So you have Linux clients and win clients?

> The difference is that the mapping requires user/password (but actually the other mappings do that as well)
You mean the standard M$ mappings (using SMB)? that's ok.
What do you mean by "other mappings", the NFS mounts/mappings? If so, I assume that Reflection behaves with NFS mounts like it does with SMB-mappings, just to *not* confuse the user (means that advanced users are wondering;-)
obg

Author

Commented:
Well, I have an experimental linux client... Otherwise, there are win clients.

From my win2k machine, using Reflection NFS client, I can browse the NFS server and "map network drives" just like I do with smb shares. I have absolutely no idea how it works on a lower level. To connect to the nfs shares, I need to enter username and password for access to the HP server (or maybe just to handle file ownership and permissions).

Commented:
With NFS each file has ownership and permistion it has on the server.

Exception:

You can map a user to a different name UID when you export.
I.E. if UID is different on remote machine. The mapping is done by the exporter. See manual for exportfs /etc/exports

obg

Author

Commented:
I guess that's the only answer there is. (Now, that I've realized how NFS works.) - Better late than never...? Reflection obviously uses some internal tricks to handle different users.
CERTIFIED EXPERT

Commented:
roughly a year, but graded anyway. Thanks.

BTW, does this question have to do with you automount limit problem?
obg

Author

Commented:
Ehh... I'm quite up to my ears in work right now, but am I having automount limit problems too...?
CERTIFIED EXPERT

Commented:
oops, mixed to much threads (obg and Gns there, Gns there, obg here, ..), seems that I'm too bussy at EE. Sorry.