4

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?

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

2 Answers 2

1

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

2
  • Isn't there an option for mount to specify user id who can write to that mount? I vaguely remember something like uuid... Commented Jan 10, 2018 at 11:07
  • UUID serves rather for filesystems :( Commented Jan 10, 2018 at 11:32
1

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.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.