4

I want to access an NFS share from within a Docker container. I don't have control over how that Docker container is started, so I can't run it in privileged mode etc. But honestly, I don't even want to run it in privileged mode because that is a completely unnecessary security risk.

It's a shame that the standard utility mount always requires root privileges. In my opinion a non-root user should simply be allowed to mount to whatever locations that user has permissions for. Is there an alternative tool that would allow me to access that NFS share without root privileges?

2

This isn't possible without having root access to either execute the mount command or the ability to install additional software within the container, again you'd need root/sudo access to do this.

The closest you can get to something that might be usable here for you would be to setup the NFS entry within the container's /etc/fstab file with the user option, so that non-root users could mount it.

$ cat /etc/fstab
10.1.1.10:/export/alice /home/alice/Desktop/mnt nfs rw,noauto,user 0 0

References

  • I think it is possible. It's just not possible with the mount utility. And btw you can install additional software without root privileged in Linux. Besides that inside the Docker container you have root privileges to a certain degree. From what I understand changing the /etc/fstab of the container won't have an effect. – Forivin Jun 26 '18 at 7:56
0

Inside the server machine you need to create a folder with the "Others" group having write access.

I'm still figuring out how to force NFS to force an umask for every new file that you create on that share, but that should get you started.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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