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 Users Found This Useful

Was this answer helpful?

Related Articles

Troubleshooting Cloudflare errors

You may encounter errors using CloudFlare from time to time. This article may help to resolve...

How can I make search engine friendly urls with my app?

The best source is the support forums for the particular app. You can also check the following...

Why can users behind proxies not see my site?

If you have enabled hot link protection users behind proxies may not be able to see your site...

Reseller: Unable to find an IP address in when creating an account

When creating accounts be sure to select a package in the package field. You can create a package...

Unable to view Ultrawebhosting.com from my foreign browser

We are an American company based out of Seattle, WA. Our website is written in English as a...