Mounting shares from Synology NAS persistent on boot up
I'm using Ubuntu 20.4 with a Synology NAS that is accessible easily from Windows and Mac
I can mount the shares using the following command in terminal:
sudo mount -o uid=linuxusername,username=shareuser,pass=sharepass //192.168.1.2/music /home/profile/Music/musicone
However, that's labourious since I have several sharepoints to mount, therefore I want to mount using fstab
for persistent mount, so I made this entry:
//192.168.42.2/music /home/profile/Music/musicone cifs uid=linuxuser,username=sharepointuser,pass=sharepointpass 0 0
I had a lot of problems making that fstab
file work, but finally I got it tweaked. I'm leaving this here in case I can help others with the same mounting issue. That is the functioning syntax. I did try using gid instead of uid, but that did not work, so this only works for one user, I think. (I only have one user, and the mounts are in that home directory)
However ...
I'd prefer to use a file for credentials, so I made a file called .smbcredentials
, substituting credentials=filepath
for the username and password.
This is not working. The sharepoint appears, but opening as user yields an error that it can only be mounted as root, and opening as root says
mount:/home/profile/Documents/nas: you may need a file type detail like /sbin/mount.(filetype) helper program
but I don't know where to place that in the syntax. There's no mount.smb
option in sbin, but there is mount.nfs
which could work, because my NAS has NFS turned on. But it doesn't, with the first error saying the share is not in host:dir format. Adding a colon after the IP of the server did not help and that didn't even get to the authentication part.
I did try putting /sbin/mount.nfs
in a few places in the syntax, leaving in the nfs reference (where cifs goes) but nothing would make the share available.
Mounting with a group id (gid=1000
) would be better, (and I'd put the mountpoints in /mnt/
) but that's not working, so if I added a user, I'd be in trouble there.
Here's two of the dozens of web pages I looked at, these yielded the most, but obviously not complete, results.
https://wiki.ubuntu.com/MountWindowsSharesPermanently
https://deathofagremmie.com/2012/05/01/mounting-a-synology-diskstation-on-ubuntu-12.04/#disqus_thread