Unable to write to mounted nfs directory

Posted on

Problem :

I don’t really know what I’m doing here, so I apologize for any lack of clarity or precision.

I have a Fedora 27 workstation and server. The server is configured to share a folder called /home/nfs on the NFS server. This server was previously running an older version of NFS, and now I believe I am using NFSv4 by default. Since the upgrade, I am unable to write to the NFS share mounted on ~/nas

Here is all the relevant information I can think of. I haven’t payed any attention to user-id’s, so they are all automatically generated.

# exportfs -v outputs:
  /home/nfs         <world>(rw,sync,wdelay,hide,no_subtree_check,fsid=0,sec=sys,secure,no_root_squash,no_all_squash)

# The permissions of the mount folder:
  drwxrwxr-x. 18 nobody nobody   4096 Mar  8 20:09  nas

# Try to 'touch ~/nas':
  touch: setting times of '/home/stg/nas': Permission denied

# Try to touch ~/nas/t
  touch: cannot touch '/home/stg/nas/t': Permission denied

# reading files works fine.
# sudo lets me write to files.

# cat /proc/mounts:
  hal:/ /home/stg/nas nfs4 rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp6,time

# on the server side, 'ls -ll /home/' gives:
  drwxrwxr-x. 18 nobody nobody 4096 Mar 10 11:38 nfs

I can make the folder writeable by running chmod o+w nfs on the server, but that seems like the wrong thing to do — under NFSv3 the existing permissions worked. I tried adding the client-user to group nobody (which seems wierd) but to no effect.

Can someone explain to me what I’m doing wrong?

Solution :

Given these permissions, you will need to be nobody, or in the nobody group to write to this directory. So your venture down that path was correct.

You’ll need to restart your session after modifying the user’s groups, as these are not dynamic.

This question offers some solutions to this problem: Reload a Linux user’s group assignments without logging out. Note, however, that these solutions typically involve creating a new temporary session, and in a desktop environment, rebooting may be the best option.

Leave a Reply

Your email address will not be published. Required fields are marked *