Rasmus Einarsson

9 May 2015

How to mount network a drive in Linux

2015-09-27: Fixed a couple of typos and omissions.

Automatically mounting a shared folder from a Synology NAS on Linux (at least Ubuntu 14)

I have a Synology NAS with a few shared folders I always want to have mounted. I found a good instruction how to set this up on Synology’s website. Here we go:

apt-get install cifs-utils

For each share, add something like this to the end of /etc/fstab:

//192.168.167.200/Rasmus /mnt/cissi/Rasmus cifs user,uid=rasmus,rw,suid,credentials=/etc/cifspwd 0 0

Make sure the corresponding mount directories exist:

mkdir -p /etc/cissi/Rasmus

Create a file /etc/cifspwd:

username=Rasmus
password=changeme

For security it’s probably good to also stop users from reading the credentials file:

chmod 0600 /etc/cifspwd

Done! On the next reboot the shared folders will be mounted automatically. If you want to mount them right away, just do

mount -a