Mounting Samba shares persistently during reboot

0

To mount a samba share during each reboot we need to interact manually. This can be automated by putting the samba share entry in fstab which will automatically mount those shares by reading credentials files.

Install with Samba client pacakge

# sudo apt-get install smbfs

fstab entry syntax

//server/share /pathto/mountpoint cifs credentials=/home/username/.smbcredentials,uid=shareuser,gid=sharegroup 0 0

Edit the /etc/fstab and add your entry

//192.168.1.15/public /home/sysadmin/samba cifs credentials=/home/sysadmin/.smbcredentials,uid=sysadmin,gid=sysadmin 0 0

Create the .smbcredentials file in your home directory

username=shareuser
password=sharepassword
domain=domain_or_workgroupname

Make sure to secure the ~/.smbcredentials file by changing the permission to only read by root User.

# chmod 0600 ~/.smbcredentials

Finally, test the mount point by running mount all

# sudo mount -av

LEAVE A REPLY

Please enter your comment!
Please enter your name here