Mounting Samba Share in Linux for Startup

The following may be used to mount a samba share via your /etc/fstab file for bootup on CentOS/RedHat systems:

Create a password file for the windows mount point where desired:

Example:

 vi /root/smbpw.pass

with the following:

username=service_account
password=*********
domain=domaincontrollername


Install cifs and dependencies for samba support with the following:

 

yum install -y cifs-utils
mkdir /mnt/smb/
mkdir /mnt/smb/sharename
vi /etc/fstab

 

//windowsservername/sharedfolder/iftherearespacesuse\040 /mnt/smb/sharename cifs _netdev,x-systemd.after=network-online.target,rw,credentials=/root/smbpw.pass,dir_mode=0777,file_mode=0777 0 0

Once setup, use:

mount -a


To test mounting followed by:

df

 

to validate it was added. Reboot and verify. If it does not load on startup, adding the following to the /etc/rc.local is a great workaround:

sleep 15
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  mount -a #: mount all drives in /etc/fstab
fi

 

  • 2 istifadəçi bunu faydalı hesab edir

Bu cavab sizə kömək etdi?

Uyğun məqalələr

How do I customize error messages for my site?

Within control panel select Custom Error Pages. Select the error code link and place whatever...

Howto: Add another website to your account

You can add another website to your hosting account if your hosting plan allows for more than one...

Point my domain to my wix account

How can I point my domain name to my wix.com account?To set this up you will want to login to...

Point Multiple Domains to the Same Website

Pointing other domains to your website is easy! Simply make sure their DNS settings are pointing...

Whitelisting Our Support System Email Address

Whitelist Instructions Because we use often use html emails with http addresses in them, our...