How to Mount Samba Share on Linux
Samba is free and open-source software. The Samba protocol connects computers running Microsoft Windows and Unix systems for the sharing of files and print jobs. The software implements a wide range of services and protocols, including NetBIOS over TCP/IP (NBT) SMB (or CIFS depending on the version). Samba comes with support for POSIX extensions for CIFS/SMB. A version of Samba was developed back in 1991 in order to share files and printers across all SMB clients. The following tutorial demonstrates how to mount a Samba share on Redhat/CentOS/Fedora.
So let’s start,
1. Start by installing CIFs-utils on your system. To install, run the following command.
yum install cifs-utils
2. When the package has been installed, create a directory for mounting the shared drive.
# mkdir /media/share
3. Next, you need to create a credentials file. For security reasons, make this a hidden file with a dot (.). This should be in your home directory.
# vim ~/.smb
In the above file, set the samba credentials.
4. Edit /etc/fstab is responsible for automounting filesystems at boot time.
# vim /etc/fstab
At the end of the file, add the following line. Adapt it to your needs.
//10.4.5.10/share /media/share cifs credentials=/home/user/.smb,users,rw,iocharset=utf8,sec=ntlm 0 0
Once you have added the line above to /etc/fstab, run the following command to mount the share.
# mount -a
That’s it, Thanks for reading! I hope it was informative for you!