Ubuntu 16.04 – auto mount smb share

Create a file where your smb credentials are stored. e.g.

touch /etc/samba/user
sudo gedit /etc/samba/user

Enter your credentials like this:


create the directory where you want your smb share should be mounted

sudo mkdir /media/smb_share

edit your fstab to auto-mount your smb share

sudo gedit /etc/fstab

add a line like this:

//myserver_ip_address/folderToShare/  /media/smb_share/  cifs  credentials=/etc/samba/user,noexec  0 0

Unfortunately the mount will fail, you have to install cifs-utils

sudo apt-get install cifs-utils

After that you can try the following command which should mount your smb share. If you don’t install cifs-utils, this command should fail.

sudo mount /media/smb_share