Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm writing software for an embedded linux system and I'm using an NFS share as root directory. The root filesystem resides in /srv/nfs/rootfs, and it is exported using the following /etc/exports:

/srv/nfs *(rw,no_root_squash,no_subtree_check,async,wdelay)

The content of /srv/nfs/rootfs need to be owned by root, otherwise the target system will have trouble mounting /dev. However, I need to be able to modify the files in /srv/nfs/rootfs as regular user, and I don't want to add sudo to my scripts or run sudo on every other command. Is there some way of configuring NFS to fake root privileges on /srv/nfs/rootfs? I was thinking of trying to run nfs using fakeroot, but that does not seem like the best solution to me.

share|improve this question
up vote 1 down vote accepted

You can use ACLs on /srv/nfs/rootfs to give additional user(s) write access - see man setfacl / man getfacl for more info. If you decide to go this way, using the default ACLs might be a good idea - this would ensure, that the ACLs set for directories get propagated on file/directory creation. Yet there is a catch: the newly created files will be owned by the user creating them. Hence you might want to run chown root: periodically on your NFS export or hook something to FAM (File Alteration Monitor, e.g. gamin).

As a side note: exporting writable things world-wide (/srv/nfs *(rw,...) is almost never a good idea, no matter how much one thinks his/her environment is isolated from the rest of the universe.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.