canada flag  linkedinfacebook   Call Us Today: (613) 494-5010

Mount windows share in Linux (fstab)

Ubuntu Support and Consulting

This works on any modern distribution of Linux, but we are using Ubuntu 14.04 for the process. First, install CIFS/Samba tools, required to mount the share point:

In Ubuntu:

apt-get install cifs-utils

Now let's create the credentials file:

vim /etc/samba/credentials

Where the format is:

username=altuser
password=P@ssWORD

Because it is plain text, we want to make sure that only privileged users can access it

chmod 0600 /etc/samba/credentials

Then add a mount point to the /etc/fstab (all in one line):

//192.168.1.10/backup  /mnt/backup  cifs    credentials=/etc/samba/credentials,rw,nounix,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0

Once done, you can mount using mount -a (or mount /mnt/backup as in example above)

Last updated Aug 2, 2018