HowTo mount a QNAP samba share automatically in Ubuntu

15.10.2020

Last modified: 15.10.2020
estimated reading time 1 min

1. Creating the credentials file

Create a cifscredfile in your home directory – for example like this

nano /home/lars/cifscredfile

Then enter the following:

username=lars
password=password
domain=QNAP

Save the file with STRG + o and exit nano with STRG + x. Next restrict the access to the credentials file to root only by typing

sudo chmod 0600 /home/lars/cifscredfile

2. Creating the mount point

That’s quick and easy. Use a terminal and type

sudo mkdir /mnt/qnap
chmod 0777 /mnt/qnap

3. Create the entry in the fstab file

This one is easy too – if you know what to type – this is the essential part of the procedure. Open the file /etc/fstab with sudo privileges and append the following line:

//192.168.1.50/Container/container-data/webserver /mnt/qnap cifs user,credentials=/home/lars/cifscredfile,uid=1000,gid=100,_netdev,iocharset=utf8 0 0

Substitute the IP address with the IP address of the qnap nas share, the uid and gid of the nas user you entered in the credentials file and the path after the ip with the shared folder that you want to mount.

4. Mounting

Finally ready for a test ride. Save and exit the fstab file and test the mount with

sudo mount -a

That’s it 🙂 done

Tags:
Was this article helpful?
Dislike 0
Views: 22