Permanently Mount CIFS/SMB Share in Ubuntu

I have a few SMB Shares running in my Home which i wanted to access from one of my Ubuntu Desktops.  The Share in question was a Software repository on my NAS and so in my instructions you will see software or sw referenced, these you will have to change with your equivalent.

First thing to do is grab the cifs-utils

sudo apt-get install cifs-utils

Next we need to create a Directory on the Ubuntu machine to Mount the Share to.  In my case I am creating a Directory called sw in /mnt

sudo mkdir /mnt/sw

Now we need to add this mapping into the fstab

cd /etc/

sudo nano fstab

The synatx is as follows:

//servername/sharename  /media/windowsshare  cifs  username=<Username>,
password=<password>,iocharset=utf8,sec=ntlm

Where;

  • iocharset=utf8 allows access to files with names in non-English languages.

  • sec=ntlm allows ntlm authentication which i have on my SMB Shares

At the end of my fstab I entered the following:

//192/168.16.31/software /mnt/sw cifs username=admin,password=password,iocharset=utf8,sec=ntlm

screen-shot-2016-11-04-at-15-26-50

Write out the changes in Nano

Test connectivity by issuing:

sudo mount -a

If this comes back with no errors, the share should mount after each reboot.

There is some good information Here on adding credentials via txt file and securing but as this is my home environment i don’t need that.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s