1

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

7
  • subsituting 'nfs' for 'cifs' in the mount syntax does not successfully mount the sharepoints. in user, I can see the shares, but I cannot open them. In user mode I get "only permitted as root" and in root mode I get "mount.nfs: share not in host:dir format" Adding a colon after the server's IP did not resolve this problem. that was one suggestion I had tried, I'd be very happy if you could provide a syntax for sharing. adding the colon gave the error "failed to resolve server, name or service unknown. Jun 17, 2021 at 13:04
  • Do you have a mount.cifs in /sbin? Jun 17, 2021 at 13:07
  • no, I don't have that. I do have mount.nfs. mounting cifs works fine, except I can't put the credentials in a file and read them. Jun 17, 2021 at 14:27
  • I reconfigured the Synology, adding an NFS permisson on one of the shares. I confgured mapping root to admin, and configured a matching user for my linux "profile" account, with read-write permissions on the nfs share. I can easily browse to the folder through the network, but have been unsuccessful in mounting it with nfs profile@Ubuntu-pc:~$ sudo mount 192.168.42.2:/volume2/MusicTwo /home/profile/Music/nfstest mount.nfs: access denied by server while mounting 192.168.42.2:/volume2/MusicTwo Jun 17, 2021 at 16:55
  • I keep getting "access denied by server" after trying several tweaks to the NFS permissions on the server and in the nfs options. For me, NFS is a non-starter for mounting it. I can browse to it, since I have a user account on the Synology now, but I can't mount it. Not by command line, nor in the fstab. The prohibits access to the share from several programs as they won't access it unless it's locally mounted. Jun 17, 2021 at 17:35

1 Answer 1

0

Do you have a mount.cifs in /sbin? If not, try and install smbclient

sudo apt-get install smbclient

I used to do so but now I use automount. That solution has the advantage of automatically mounting your shares as soon as your NAS becomes available.

Edit: Re-installing cifs-utils, it worked (sudo apt install cifs-utils)

10
  • I ran that install, but neither mount.cifs or mount.smb is not in /sbin Jun 17, 2021 at 14:32
  • Are the cifs-utilsalso installed? (sudo apt install cifs-utils) Jun 17, 2021 at 15:04
  • I did install smbclient, but it did not improve anything Jun 17, 2021 at 15:09
  • yes, cifs-utils were install some time ago Jun 17, 2021 at 15:26
  • 1
    @PeterAddison Also, if the answer solved the problem, mark it as 'accepted', so that further users can spot it easily. Jun 20, 2021 at 16:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .