Date Modified Tags cifs / Ubuntu


Mounting network drives in Linux is something I do often but apparently not often enough to memorize the command syntax. So, this is another article I am adding mainly as a reference to myself but also maybe it can help someone else out there.

Install cifs-utils

The first step is install cifs-utils:

sudo apt-get install cifs-utils

Then you can run the following command to mount the network drive:

sudo mount // -t cifs -o username=joelinux /mnt/destFolder/

Note that depending on permissions you may also need to provide a uid and gid:

sudo mount // -t cifs -o uid=1000,gid=1000,username=joelinux /mnt/destFolder/

To get the uid and gid you can use:


Now, the moment you reboot, your drive will not be mounted. There is a little bit more to do to get it to auto-mount at boot.

Setting up the mount to run at boot

This is actually fairly easy to do in Ubuntu.

Add the following to the fstab file in /etc/:

// /mnt/hplin cifs username=joelinux,password=thisisnotarealpassword,iocharset=utf8,sec=ntlm 0 0

Finally, test the fstab entry by issuing:

sudo mount -a

If you get no errors, then you know the format of your command is correct in fstab. Reboot your machine to double check that the drive mounts as expected.

Password security

Note that it is obviously not secure to provide your password in a text file that is accessible to all users. If this a machine that others may access then be sure to follow the instructions in:


comments powered by Disqus