Samba is the standard Windows interoperability suite of programs for the Unix and Linux operating systems. Samba server uses SMB/CIFS protocol for the secure, stable and file/printer sharing.
This tutorial will help you to mount remote samba share to your Linux system.
Mounting Samba Share on Unix and Linux
Follow the step by step guide for the mounting of remote samba share on Ubuntu and Debian system. Also enables to auto mount 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 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.
Set the samba username and password to above file.
- Step 4 – Use the following command to mount remote samba share on a Linux system.
sudo mount -t cifs -o rw,vers=3.0,credentials=/root/.smbcredentials //192.168.1.10/share /media/share
But the manually mounted file system will not remain mounted after a system reboot. To mount samba share automatically after system reboot, complete next step.
- Step 5 –You can make add the configuration to
/etc/fstabfile to auto mount remote share on system boot.
Edit the below configuration file in your favorite text editor:
sudo nano /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 vers=3.0,credentials=/.smbcredentials
In this tutorial, you have learned to mount remote samba share on Unix like system. Also enabled to mount remote share on system boot.