0

I want to mount a network drive on a NAS (Synology DiskStation) when my linux server (old headless desktop running Ubuntu 20.04.2 LTS) boots, and I want to make the share available to all users under /mnt. I plan to see if I can write a script to back up some files to this share regularly so that if anything happens to my server, my files are back up on my NAS.

I have set up the network share with NFS on the NAS (IP address of linux server has read/write, Squash: No mapping), created the share directory under /mnt, I mounted the share, copied a few files to it as my regular non-root user, checked the files were on the NAS. Everything worked great. I rebooted, and the mount was gone. I expected this and looked up how to have the system mount this share at startup. I added the following line to my fstab.

<nas_ip>:/volume1/share  /mnt/share    nfs     user,rw,hard,intr       0       0

I rebooted, went to /mnt, and attempted to "cd /share" and get "Permission denied".

Eventually getting frustrated, I switched to root (sudo -i) and "cd /share" worked perfectly. I even created a new folder directly on the NAS and verified it was visible via command line as root. The network share is mounting and working, but no user besides root has access.

Is there something else I need to do? As I understand it, the "user" option under fstab should give all users access to the mount. Am I doing something wrong?

Thanks!

2
  • 1
    No, the user option just gives every user the permission to mount and unmount that filesystem. What you need is a mapping from your user IDs on your Linux to the user IDs on your NAS. – HuHa Mar 14 at 16:35
  • Thanks for clearing up that misunderstanding! – Patrick Mar 14 at 17:13
0

To make files actually accessible, you could use the admin interface on your NAS to set their owner to your user ID on your Linux machine, or you could try the uid=... and gid=... mount options in the /etc/fstab entry; see man 8 mount:

uid=value, gid=value and umask=value

Set the file permission on the filesystem. The umask value is given in octal. By default, the files are owned by root and not readable by somebody else.

1
  • Thanks! Since I'm not worried about security on this particular share, I set squash to map all users to "guest" and gave guest full access to the new share on the NAS. It's working fine now. – Patrick Mar 14 at 17:26

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.