In this article I will show how you can mount samaba shared directory on your Ubuntu and Debian system. 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.
Mount Samba Share On Ubuntu/Debian
Follow the below steps:
1. First of all install cifs-utils package on your system. Than run the below command on the terminal for the installation.
$ sudo apt-get install cifs-utils
2. After installing package now create a directory to mount the share drive.
$ sudo mkdir /media/share
3. Next 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.
$ vim ~/.smb
Set the samba username and password to above file.
4. Now edit the /etc/fstab file which is responsible to automount any filesystem during system boot. So this is the best place to automount directory.
$ sudo vim /etc/fstab
Add the line at end of the file as follows. Change values as per yours.
//192.168.1.10/share /media/share cifs credentials=/home/user/.smb,users,rw,iocharset=utf8,sec=ntlm 0 0
Run the below command after adding the above line in /etc/fstab file to mount the share.
$ mount -a