Table of Contents
Introduction
In this tutorial, How to automatically mount a SMB/CIFS Share on CentOS.
Prerequisite
Install necessary packages
yum install samba-client samba-common
Install the Automounter
yum install autofs
Create a mount point
mkdir /data/cifs_share
Add an entry to the file /etc/auto.master, as follow:
/data/cifs_share /etc/auto.cifs --timeout=600 --ghost
create the file /etc/auto.cifs:
share_data -fstype=cifs,rw,noperm,credentials=/etc/credentials.txt
://<Host Name>/<Folder Name>
Create /etc/credentials.txt file
username=DOMAIN/User
password=PASSWORD
Secure the credentials.txt file
chmod 0700 /etc/credentials.txt
Restart the automounter service
/etc/init.d/autofs restart
Confirm that the mount is being accessed correctly
mount
Conclusion
You have automatically mounted an SMB/CIFS Share on CentOS. I hope will this your helpful. Thank you for reading the DevopsRoles page!