How do I mount a nfs or any other share which requires usage of -o in the mount command so that the mount can be accessed by non-root user. If mount is user with -o option, it complains that only root can do that but if I do that as a root, the normal user cannot write to that because the directory becomes root to where it is mounted becomes root owned. Is there an option for mount to avoid this?

  • if it's in the /etc/fstab file, you can add the ,user option (which allows users to mount) – guiverc Jan 10 '18 at 10:52
  • I want to do it as necessary, not put it in fstab. – leosenko Jan 10 '18 at 10:53
  • Is this on Linux or some other Unix? – Kusalananda Jan 10 '18 at 11:40

If you'd connect through cifs, you may want to use I.E. dir_mode and file_mode options.

This works perfectly to me, every folder and file is writable by anyone.

mount -t cifs //server/path -o user=username_on_server,dir_mode=0777,file_mode=0776 target_dir

However, I don't see such an option for nfs.

More about NFS permissions can be found on centos.org

| improve this answer | |
  • Isn't there an option for mount to specify user id who can write to that mount? I vaguely remember something like uuid... – leosenko Jan 10 '18 at 11:07
  • UUID serves rather for filesystems :( – Edvard Rejthar Jan 10 '18 at 11:32

You can use fuse to mount various file systems as ordinary users.

I would definitely use fuse for sshfs, encrypted fileshare, and mountable by ordinary users, provided they are allowed to ssh into the file server.

| improve this answer | |

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.