gcnppq
Last Updated: February 25, 2016
·
10.32K
· brianwebb01

How to mount a windows (smb / cifs) file share on Linux

I have a windows file share that I need my Ubuntu Linux server to have access to. We'll put the info in /etc/fstab to be durable through reboots etc.

To start we'll need to put our file share credentials into a file. I find a safe place to do this is in /root/.smbcredentials:

username=bobsyouruncle
password=pa55w0rd1234

Now we'll need to add the actual mount entry to /etc/fstab. For the sake of example we'll say our share is 192.169.0.100/MyShare and we want to put it in an existing directory /mnt/myshare:

//192.168.0.100/MyShare /mnt/myshare cifs credentials=/root/.smbcredentials 0 0

Now we just need to mount it up with mount -a. You can verify it is mounted with the simple mount command.

Done.