Last Updated: February 25, 2016
· 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:


Now we'll need to add the actual mount entry to /etc/fstab. For the sake of example we'll say our share is and we want to put it in an existing directory /mnt/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.