NFS Share between NAS and 2 clients - why DOES it work?

  • I know the title may seem confusing but let me explain. I am using OMV 7 on a NAS and exported a NFS share without modifying any options:



    On my clients I created the following mount points and /etc/fstab entries:


    Nobara:

    Code
    192.168.178.4:/nfs_share /mnt/nfs-share nfs defaults 0 0


    Fedora Kinoite:

    Code
    192.168.178.4:/nfs_share /var/mnt/nfs-share nfs defaults 0 0


    The users on both clients have the same username (which is different from the OMV user) and do own the mount points (UID:GID). UIDs are the same, GIDs differ on the two clients:

    Nobara: UID=1000, GID=1001

    Kinoite: UID=1000, GID=1000


    The exported folder "nfs_share" is owned by root and group users which has GID 100.


    After mount -a I expected to see some error messages but there was nothing to see. The nfs share is mounted on each client and is RW.


    Back to the title of the topic: why does this work? It´s nice it does - but I expected it not to which means I don´t fully understand NFS :/


    Any idea?

  • Why did you expect not to work. NFS was design and implemented originally by SUN Microsystem for their UNIX OS.

    You have install "nfs-common" client, created proper /etc/fstab, although I would not use "/var" to mount remote nfs share(s). I, personally, use "/media/nfs/"sharename" on the client machine. Defaults work, as you noticed

    Linux Mint 22, openSUSE, Arch Linux

    OMV7 NAS 10GB Fiber, Fractal Design Define R5 Case, Kodi "Omega", FreeBSD pfSense Plus firewall/router

    Edited once, last by andrzejls ().

  • although I would not use "/var" to mount remote nfs share(s). I, personally, use "/media/nfs/"sharename" on the client machine.

    Thank you for your reply.


    Since I was just playing around I chose /mnt for its temporary character over /media or any other directory. Regarding the mountpoint on /var:

    On Fedora Kinoite, the root filesystem (/) is immutable. The /usr directory and everything below it is read-only.

    The /etc and /var directories are respectively used to store configuration files and runtime state and are thus writable. Symlinks are used to make traditional state-carrying directories available in their expected locations. This includes:

    • /home/var/home
    • /opt/var/opt
    • /srv/var/srv
    • /root/var/roothome
    • /usr/local/var/usrlocal
    • /mnt/var/mnt
    • /tmp/sysroot/tmp



    Why did you expect not to work. NFS was design and implemented originally by SUN Microsystem for their UNIX OS.

    You have install "nfs-common" client

    I am wondering why my clients have read-write access on the share. The UIDs and GIDs don´t match and I did not set any options like all_squash, anonuid, anongid, etc. Since mounting works I expected to only see the share but with read-only at best.


    Are there any export options set by default not visible in the GUI?

  • I would presume that you set "Read/Write" access to the NFS shares in OMV. I also use "sync,no_subtree_check,insecure,all_squash,anonuid=1000,anongid=100" in "Extra Options" field.

    On the Client side, in my fstab I use this settings:

    192.168.1.XXX:Files /media/nfs/Files nfs4 rw,auto,hard,nofail,intr,async,comment=x-gvfs-show,bg 0 0

    (comment=x-gvfs-show setting is for Nvidia 4060 video card that I use).

    Linux Mint 22, openSUSE, Arch Linux

    OMV7 NAS 10GB Fiber, Fractal Design Define R5 Case, Kodi "Omega", FreeBSD pfSense Plus firewall/router

  • I also use "sync,no_subtree_check,insecure,all_squash,anonuid=1000,anongid=100" in "Extra Options" field.

    This is exactly what is confusing me. I would expect my clients to have rw-access on my NFS share with these options set even if UID and GID are different between client and server. But I don´t use these options and my clients still do have rw-access.


    Can anyone point me in the right direction?

  • Giving "Read/Write", rw-rw-rw also known as 666 (owner-user-group), permissions on "share" does it.

    Linux Mint 22, openSUSE, Arch Linux

    OMV7 NAS 10GB Fiber, Fractal Design Define R5 Case, Kodi "Omega", FreeBSD pfSense Plus firewall/router

  • I think I solved it. It is the way NFSv4.x handles permissions. Versions prior to 4 worked the way I had in mind. I wasn´t aware of the changes in v4.x:

    Quote

    Added clarifications and error conditions for the handling of the owner and group attributes. Since these attributes are string based (as opposed to the numeric uid/gid of previous versions of NFS), translations may not be available and hence the changes made.

    After double checking names, UIDs and GIDs I found that I randomnly created a case which works.

  • mr.frost

    Added the Label resolved

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!