Thursday, September 17, 2015

How to mount password protected network attached storage on Ubuntu

To mount NAS (network attached storage) to a Unix server such as Ubuntu 14.04.1 LTS do the following. First install cifs-utils package.

sudo apt-get install cifs-utils

Then, create a folder where the NAS will be mounted, e.g.

mkdir /home/diskstation

Next, create a file with username and password.

touch ~/.smbcredentials

Add to the file your username/password to access the NAS.


Change credentials to the file.

chmod 600 ~/.smbcredentials

Open fstab file.

sudo nano /etc/fstab

Add the following line (substitute ip.address with the IP of NAS and folder with the name of your shared folder).

//ip.address/folder /home/diskstation cifs credentials=~/.smbcredentials,iocharset=utf8,sec=ntlm 0 0

Mount the NAS for the current session.

sudo mount -a

Since you modified fstab file NAS should auto-mount every time you restart the server.

In case you want to add additional storage to the NAS through USB, you can do the same to mount it.

Add the line to stab (Substitute ip.address with your IP address of NAS, and usbshare1-2 with the folder where your usb was mounted in NAS). Before this create folder /home/diskstation2 where USB drive will be mounted on the Ubuntu server.

//ip.address/usbshare1-2 /home/diskstation2 cifs credentials=~/.smbcredentials,iocharset=utf8,sec=ntlm 0 0

No comments:

Post a Comment