Mount Samba share on Ubuntu and Debian

Mount Samba share on Ubuntu and Debian

These steps will help you to mount remote samba shared directory to your system. Follow the step by step guide for the mounting of remote samba share on Ubuntu and Debian system. Also enables to automount shared drive even after system reboot.

Step 1 – You need to install package cifs-utils on your system. Run the following command on the terminal for the installation.

sudo apt-get install cifs-utils

Step 2 – After that create a directory to mount the share drive.

sudo mkdir /media/Share

Step 3 – Now create a credentials file to your system. Make this as a hidden file using dot (.) for security purpose. It’s good to create it in your home directory.

nano ~/.smbcredentials

Set the samba username and password to above file.


Step 4 – Finally configure the /etc/fstab file which is responsible to automount any filesystem during system boot. So this is the best place to automount directory.

sudo nano /etc/fstab

Add the line at end of the file as follows. Change values as per yours.

// /media/share cifs credentials=/home/user/.smbcredentials,users,rw,iocharset=utf8,sec=ntlm 0 0

Leave a Reply