NFS Network Mount: Setting an Owner for a Specific Account

Well, I am seriously confused in this material, so the visual answers will be very appreciated, especially if they make all this editing material less magical and more predictable.

I am trying to connect NAS Drobo-FS to nfs to get better performance than with cifs.

Some sort of ordered distribution of linux works for fractionally.

Inside / etc / fstab on the client machine (Ubuntu with IP: 192.168.1.150)

# Mount Drobo 192.168.1.100:/mnt/DroboFS/Shares/public /media/drobonfs nfs rw,soft,proto=tcp,users 0 0 

I have an unsd function set to fractional and access via ssh. This is the export file on the server machine (Drobo-FS with IP 192.168.1.100):

 # Allow access for client machine /mnt/DroboFS/Shares 192.168.1.150(rw,no_root_squash) 

Mounting works fine, except that all attached files are owned by root, and most file permissions are set to 744. The file permissions specified in mount on the client correspond to the actual permissions on the server. For instance:

 client$ sudo chmod 123 /media/drobonfs/somefile client$ ls -l /media/drobonfs/somefile ---xw--wx 1 root root 0 2012-01-04 14:15 /media/drobonfs/somefile drobo$ ls -l /mnt/DroboFS/Shares/public/somefile ---xw--wx 1 root root 0 Jan 4 14:15 /mnt/DroboFS/Shares/public/somefile 

Writing sudo before each command is a drag and drop, and I want to understand what is happening and what can I do to mount it on the client machine with adding the owner / group to my account instead of root?

+6
source share
3 answers

When the share is mounted, the user identifier (UID) of the host system is mapped to the user identifier (UID) of the client.

On the client, the associated user (based on the user ID) will become the owner of the mounted resource.

Your problem is because the host uses a different UID and then the client.

You can solve this problem by specifying the /etc/nfs.map file:

/etc/nfs.map

It will look like this:

# remote local gid 500 1000 # drobo client uid 500 2003 # drobo client

Therefore, when using NFS, you need to make sure that there is a UID / GID match between users on the host and client. Also read the following article: http://www.kernelcrash.com/blog/nfs-uidgid-mapping/2007/09/10/

Another great way to solve this problem is to look at the host and client systems in the UID by looking at this /etc/passwd on both systems.

or by typing:

 id tom 

change the UID with:

 usermod -u 10000 tom 

Good luck

+4
source

It looks like this should work in exporting to Drobo:

/ mnt / DroboFS / Stocks 192.168.1.150 (rw, all_squash, anonuid = NNN)

where NNN is your numeric user ID on the client.

+1
source

Change / etc / exports to:

 /mnt/DroboFS/Shares 192.168.1.150(rw,insecure) 

and then on the NFS server run:

 $ sudo exportfs -a 

Now, when you mount the directory as a non-root user in the NFS client, it will be mounted with the appropriate owner and group.

0
source

Source: https://habr.com/ru/post/905148/


All Articles