There is a point to this story, but it has temporarily escaped my mind...
Contact Me MyFaceBook MyLinkedIn MyGitHub MyTwitter

Configure System To Automount a Samba Share

First, make sure that the CIFS mount tool is installed:

sudo apt-get install cifs-utils

Next, edit the /etc/fstab file and put an entry for each Windows/Samba share that you want to mount.

//server/share /mnt/share cifs credentials=/root/.smbpasswd,file_mode=0666,dir_mode=0777 0 0
|              |          |    |
|              |          |    ^---------  Mount Options
|              |          ^--------------  Type of file system (smbfs or cifs)
|              ^-------------------------  Local Mount Point
^----------------------------------------  Windows Share Name

Create the “smbpasswd” file in root's home directory.

echo domainname=mydomain > /tmp/.smbpasswd
echo username=myusername >> /tmp/.smbpasswd
echo password=mypassword >> /tmp/.smbpasswd

sudo mv /tmp/.smbpasswd /root/.smbpasswd
chmod 600 /root/.smbpasswd

Replace username and password with your actual parameters. If you have multiple user accounts to multiple shares, you'll want to create a different “smbpasswd” file for each user account.

Copyright © 2015 by Julian Easterling. SOME RIGHTS RESERVED.

Creative Commons License
Except where otherwise noted, content on this site is
licensed under a Creative Common Attribution-Share Alike 4.0 International License.


All of the opinions expressed on this website are those of Julian Easterling and
do not represent the views of any of my current and previous clients or employers in any way.

If you notice an error on the site or content that has not been properly attributed, bring
it to my attention using the contact page and I will endeavor to fix it as soon as I can.

I accept no responsibility or liability for any damages incurred by following any of
my advice or by using any of the information on my site or of those sites that I link to.