Home Linux Samba network share automatic mount

Samba network share automatic mount


Samba is a free software re-implementation of the SMB/CIFS networking protocol, and was originally developed by Andrew Tridgell. Samba provides file and print services for various Microsoft Windows clients. Samba runs on most Unix, OpenVMS and Unix-like systems, such as Linux, Solaris, AIX and the BSD variants, including Apple’s macOS Server, and macOS client (Mac OS X 10.2 and greater). Samba is standard on nearly all distributions of Linux and is commonly included as a basic system service on other Unix-based operating systems as well.

Now let’s see that we how can mount such drives on Ubuntu or Mint as you automatically turn on your computer.

We need install cif-utils (even if you already have Samba and related packages installed):

sudo apt-get install cifs-utils

Edit the fstab file:

sudo mcedit /etc/fstab

Add your entry:

#SMB drives
//server/share /pathto/mountpoint cifs credentials=/home/username/.smbcredentials,uid=shareuser,gid=sharegroup 0 0

Ubuntu 17.10:

#SMB meghajtok
//server/share /pathto/mountpoint cifs iocharset=utf8,credentials=/home/username/.smbcredentials,uid=1000,nofail,vers=1.0 0 0

Create the .smbcredentials file in your home directory:

mcedit /home/username/.smbcredentials

Add your entry:


Make sure you secure your ~/.smbcredentials file:

chmod 0600 ~/.smbcredentials

Finally, test the mount with:

sudo mount -a

Now, when you turn on the computer, the selected network drives are automounted.