How to automatically mount a SMB/CIFS Share on CentOS 6

Install necessary packages

yum install samba-client samba-common autofs

Create a mount point

mkdir /mnt/cifs_share

Create an entry in the /etc/auto.master file

/mnt/cifs_share /etc/auto.cifs --timeout=600 --ghost

Create /etc/auto.cifs configuration file

share_data -fstype=cifs,rw,noperm,credentials=/etc/credentials.txt
://<Host Name>/<Folder Name>

Create /etc/credentials.txt file


Secure the credentials.txt file

chmod 0700 /etc/credentials.txt

Restart the automounter service

/etc/init.d/autofs restart


  1. How to Mount a SMB/CIFS Share as an auto-mount on CentOS/Fedora/RHEL
Last updated on by Yasitha Bogamuwa