Linux

Auto Mount SMB/CIFS Shares Ubuntu 11.10

If you are always accessing network shares from your Linux desktop you might find it easier to have those shares automatically mounted at login.

This can be achieved like so on a Ubuntu installation:

Step 1

First we’ll add our remote SMB/CIFS share information to the /etc/fstab file:

sudo nano /etc/fstab

And at the end of the bottom of the fstab file add the following:

//YOURSMBCIFSSHAREIP /media/YOURSMBCIFSSHARE smbfs credentials=/home/YOURUSERNAME/.smbcred,gid=users

Simply put your SMB/CIFS share IP address and then the desired name that will appear in /media/ as. Then in the next step we’ll create a credentials folder so you’ll want to put in your username in the path there and ultimately we want to allow all users to access this share, so we add the users group.

Step 2

Now create a credentials file in your home directory /home/yourusername

 nano ~/.smbcred

And add the following in the newly created file:

username=YOURSMBUSERNAME
password=YOURSMBPASSWORD

Now you don’t have to create the .smbcred file if authentication is disabled on your share. You can leave the fields blank or remove credentials=/home/YOURUSERNAME/.smbcred.

twitterredditpinterestlinkedinmail

Leave a Comment

Your email address will not be published. Required fields are marked *