How to mount CIFS share permanently on Ubuntu


apt-get install cifs-utils

Create directory:

mkdir /mnt/cifs

Create file:

nano ~/.smbcredentials

Insert the username and password for accessing the remote share:


Run command to get your gid and uid. Replace root with your user name.

id root

Example output:

uid=0(root) gid=0(root) groups=0(root)

Now edit the fstab:

nano /etc/fstab

Add below line to the end and save it:

// /mnt/cifs cifs credentials=/root/.smbcredentials,iocharset=utf8,gid=0,uid=0,file_mode=0777,dir_mode=0777 0 0

Mount share:

mount -a