In this article I will show how you can mount samaba shared directory on your CentOs/Fedora/Redhat system. The step by step guide for the mounting of remote samba share on CentOs/Fedora/Redhat system. Also enables to automount shared drive even after system reboot.
Mount Samba Share On CentOs/Fedora/Redhat
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.
# yum install cifs-utils
2. After installing package now create a directory to mount the share drive.
# 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.
# vim /etc/fstab
Add the line at end of the file as follows. Change values as per yours.
//192.168.1.5/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