Skip to end of metadata
Go to start of metadata

You will need to install cifs-utils in order to mount samba shared directory:

sudo yum -y install cifs-utils

To mount in root account, run below commands:

sudo mount -t cifs // /mnt/nas -ousername=yourUserName,password=yourPassword,file_mode=0664,dir_mode=0775,uid=root,gid=root

If you want to mount the samba shared directory when your server boot, you will need to create your credentials at /your_preferred_directory/config


and add below lines at /etc/fstab

// /mnt/nas cifs    credentials=/your_preferred_directory/config,uid=root,gid=root 0 0

If you want to add some permission for file and folder,

// /mnt/nas cifs    credentials=/opt/config/nas.cfg,uid=root,gid=root,dir_mode=0775,file_mode=0775,sfu 0 0

If you want to take it effect right away, run

sudo mount -a

Otherwise, the samba shared directory will be automatically mounted when you reboot your machine.

By the way, I recommend you to use sshfs instead of samba if you want a better performance based on my experience. You can see more at Mount remote directory by SSHFS in CentOS 7