You are not logged in.

#1 2022-10-13 23:36:20

felixculpa
Member
From: Alberta, Canada
Registered: 2012-06-12
Posts: 268

[SOLVED] NFS Permissions

Hi all. Long time no see.

I am trying to set up NFS but the mounts only show up as root owned without my local user having read access. Relevant configs below.

On Server (Arch):

/etc/exports

/srv/nfs/ 192.168.0.0/24(rw,sync,crossmnt,anonuid=5001,anongid=5001,fsid=0)
/srv/nfs/document 192.168.0.0/24(rw,sync)
/srv/nfs/downloads 192.168.0.0/24(rw,sync)
/srv/nfs/pictures 192.168.0.0/24(rw,sync)

/etc/fstab

/home/<username>/Documents /srv/nfs/documents none bind 0 0
/home/<username>/Downloads /srv/nfs/documents none bind 0 0
/home/<username>/Pictures /srv/nfs/documents none bind 0 0

Username ID
5001

On Client PC (Fedora):

/etc/fstab

<hostname>:/documents /home/<localusername>/Documents nfs user,nfsvers=4,defaults 0 0
<hostname>:/downloads /home/<localusername>/Downloads nfs user,nfsvers=4,defaults 0 0
<hostname>:/pictures /home/<localusername>/Pictures nfs user,nfsvers=4,defaults 0 0

Username ID
1000

Things of possible note:

  • If I do mount -a from the client PC they mount with root:root permissions.

  • Hostname is in my /etc/hosts file and maps to the server IP.

  • NFS service has been added/allowed through firewalld.

  • File system on Server is ext4, File system on Client is btrfs.

Last edited by felixculpa (2022-10-14 17:11:48)

Offline

#2 2022-10-14 00:44:02

felixculpa
Member
From: Alberta, Canada
Registered: 2012-06-12
Posts: 268

Re: [SOLVED] NFS Permissions

So I was super confused by this because I had a user account on both with the same name, but different UID. It's all about the UID with NFS. So I moved the files on the server to a user with a matching ID and this (I'm assuming, still moving files) should fix the problem?

Offline

#3 2022-10-14 06:47:20

seth
Member
Registered: 2012-09-03
Posts: 60,805

Re: [SOLVED] NFS Permissions

https://wiki.archlinux.org/title/NFS

The Note on the top wrote:

NFS expects the user and/or user group IDs are the same on both the client and server. Enable NFSv4 idmapping or overrule the UID/GID manually by using anonuid/anongid together with all_squash in /etc/exports.

Online

#4 2022-10-14 17:11:15

felixculpa
Member
From: Alberta, Canada
Registered: 2012-06-12
Posts: 268

Re: [SOLVED] NFS Permissions

I tried using the anonuid and anongid both with them set to 1000 or 5001 and they both ended up causing weird behavior. So I just used a different user with the same ID.

Offline

#5 2022-10-14 19:46:24

seth
Member
Registered: 2012-09-03
Posts: 60,805

Re: [SOLVED] NFS Permissions

"together with all_squash"?
But aligning UIDs is oc. fine - alternatively you could use UID mapping w/ NFS4

Online

#6 2022-10-14 23:42:53

felixculpa
Member
From: Alberta, Canada
Registered: 2012-06-12
Posts: 268

Re: [SOLVED] NFS Permissions

Hmm. I may try that later, I think all_squash is a default option because root couldn't do anything until I added the opposite option explicitly.

Offline

Board footer

Powered by FluxBB