Mounting a Synology DiskStation on Ubuntu 12.04
I have a Synology DiskStation that I use for a home NAS. I didn't take good notes when I got it to work with Ubuntu 10.04, so I had to fumble about when I upgraded to Ubuntu 12.04 last weekend. So for next time, here is the recipe I used.
First, you need to install the cifs-utils package:
$ sudo apt-get install cifs-utils
Next, I added the following text to my /etc/fstab file:
//192.168.1.2/shared /mnt/syn cifs noauto,iocharset=utf8,uid=1000,gid=1000,credentials=/home/brian/.cifspwd 0 0
Take note of the following:
- Replace //192.168.1.2/ with the IP address or hostname of your DiskStation. Likewise, /shared is just the path on the DiskStation that I wanted to mount.
- /mnt/syn is the mount point where the DiskStation will appear on our local filesystem.
- I didn't want my laptop to mount the DiskStation on bootup, so I used the noauto parameter.
- The uid and gid should match the user and group IDs of your Ubuntu user. You can find this by grepping your username in /etc/passwd.
- The credentials parameter should point to a file you create that contains the username and password of the DiskStation user you want to impersonate (see below).
Your .cifspwd file should look like the following:
username=username password=password
Obviously you'll want to use the real username / password pair of a user on your DiskStation.
To be paranoid, you should make the file owned by root and readable only by root. Do this after you get everything working:
$ sudo chown root:root .cifspwd $ sudo chmod 0600 .cifspwd
I created the mount point for the DiskStation with:
$ sudo mkdir -p /mnt/syn
Then, whenever I want to use the DiskStation I use:
$ sudo mount /mnt/syn
And to unmount it:
$ sudo umount /mnt/syn
You can avoid the mount and umount commands if you remove the noauto parameter from the /etc/fstab entry. In that case, Ubuntu will automatically try to mount the DiskStation at startup.