I’m reading Jay’s book Mastering Ubuntu Server with much pleasure. But I ran into something for which I could use some help or more explanation. It’s about creating an NFS share on a server and accessing it from a client.
I have a server running Ubuntu 20.04 (ksm-server1) and a client running Ubuntu 20.04 (pc2-kees). I followed all steps written by Jay in his book (“Setting up NFS shares”). On the server I created two folders in /exports: /exports/public and /exports/documents. My /etc/exports file on ksm1-server looks like this:
/exports *(ro,fsid=0,no_subtree_checks) /exports/documents *(ro,no_subtree_checks) /exports/public *(rw,no_subtree_checks)
Note that the public folder is ‘rw’ and the documents folder is ‘ro’. The parent folder ‘/exports’ is ‘ro’ as well, just like the example in the book.
On the client I can mount these shares successfully to /mnt/documents and /mnt/public. But when trying to change a file in the /mnt/public folder on the client, I’m getting an error message saying that the filesystem is read-only. I cannot write to it.
The solution I found is to set the parent folder on the server (/exports) to ‘rw’ as well. Than the /etc/exports file looks like this:
/exports *(rw,fsid=0,no_subtree_checks) /exports/documents *(ro,no_subtree_checks) /exports/public *(rw,no_subtree_checks)
This way the public folder mounted on the client is read-write. I found somewhere on internet that any settings in /etc/exports for a child folder should overrule the settings of its parent folder. But in my case, it doesn’t behave that way: when the parent folder (/exports) is set to ‘ro’ , then the child folder (/exports/public) will be ‘ro’ as well, no matter its own settings.
Do I misunderstand something, is it a bug or something else? Any help is welcome, thanks!