How To Map A Network Drive Onto Ubuntu 14.04 Permanently

Last updated: April 22, 2024

Map Network Drive

This simple tutorial shows you how to map a network drive, Windows share as example, onto Ubuntu 14.04 LTS with read and write permission permanently.

UPDATE-2024: This tutorial is outdated, and no longer works in current Ubuntu releases!!

All things will be done in a terminal window. Not familiar with Linux command? Don’t be afraid, just paste the command into terminal and hit enter to run one by one. There will be a few pictures to make things more clear.


There are a few preliminary actions we need to do before we can start mounting using cifs.

1. Press Ctrl+Alt+T on keyboard to open the terminal. Paste the command below and run to create a mount point, you can replace ‘Ji-share’ to what you want.

sudo mkdir /media/Ji-share

Create a mount point for network share

2. Install cifs-utils, which provides support for cross-platform file sharing with Microsoft Windows, OS X and other Unix systems.

Install it from Ubuntu Software Center, or via below command:

sudo apt-get install cifs-utils

3. Edit the /etc/nsswitch.conf:

sudo gedit /etc/nsswitch.conf

Find the line looks like:

hosts: files mdns4_minimal [NOTFOUND=return] dns

change it into:

hosts: files mdns4_minimal [NOTFOUND=return] wins dns

Ubuntu resolve Windows Hostname

4. Run below command so that your Ubuntu can resolve Windows computer name on a DHCP network.

sudo apt-get install libnss-winbind winbind

Reboot Ubuntu, or restart your network.

Mount (map) network drive:

Now edit the fstab file to mount network share on start up.

1. Make a backup by running the command below:

sudo cp /etc/fstab /etc/fstab_old

If you need to restore your backup, run:

sudo mv /etc/fstab_old /etc/fstab

2. Create a credentials file via:

gedit ~/.smbcredentials

insert the username and password for accessing the remote share. Replace “Ji” & “741852963” with yours and save the file.



3. Run command to get your gid and uid. Replace handbook with your user name.

id handbook

Get Ubuntu user id

4. Now edit the fstab by running the command:

sudo gedit /etc/fstab

Add below line (one line) to the end and save it. REPLACE WORDS IN RED!

// /media/Ji-share cifs credentials=/home/handbook/.smbcredentials,iocharset=utf8,gid=1000,uid=1000,file_mode=0777,dir_mode=0777 0 0

Map Network Share in Ubuntu

Finally run sudo mount -a in terminal and you’ll get the network share mapped in Unity Launcher and Nautilus file browser:

Map network share Ubuntu 14.04


I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to let me know if the tutorial is outdated! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via [email protected] Buy me a coffee:

69 responses to How To Map A Network Drive Onto Ubuntu 14.04 Permanently

  1. This is exactly what I needed! I was mapping those network drives in a way that did not give me permission to write, modify or delete my files. Thanks!

  2. This article, and your article “Ubuntu 14.04 LTS: File Sharing With Samba” are very helpful.

    Your image in paragraph 4. with the “REPLACE WORDS IN RED” left out a word to replace. “credentials/home/handbook/.smbcredentials”. “handbook” should be your userid.

    The root problem in my case, though was with the VirtualBox VM. For some reason it gave my VM’s a fixed IP address at 192.168.56.x, where the rest of my LAN was DHCP from my router at a different subnet. Annoyingly, before I figured that out, some pings would work, the Ubuntu VM would show up on the Win7 Network folder, and vice-versa, and ping would resolve the names, but fail. I eventually found the setting page for the host-only ethernet. You have to go to the VirtualBox Manager, click File (upper left)>preferences>Network>Host-only Network, click on the adapter and then the edit brush on the right of that panel. Enable the DHCP server check box.

    Of course, now that sharing works, Firefox access to the net does not. I’m doing this for a couple of on-line courses, for the programming test bed. If this were a production environment, I would be fired for this incoherence.

    Anyway go to the VirtualBox Manager, select your VM, click settings (2nd line from top of Manager Panel, and change the active network adapter from “internal network” to “bridged adapter”. Reboot the VM. Now all works, except the “mount-a” from your paragraph 4. won’t allow a click from Nautilus because of permissions. But I can at least get to my shares by “Browse Network”.

    So 3 days later I can print on my networked Dell 2150cdn (cups and Dell drivers not part of base Ubuntu), share folders with my VM and my Windows 7 Workgroup (sharing, Samba, cifs not part of VirtualBox or Ubuntu base), copy/paste from host to VM (not part of VirtualBox Base), and use the internet (part of the VirtualBox/Ubuntu base, but is easily broken).

    My environment:
    Win 7 pro SP1 updated 8/30/2014
    VirtualBox 4.3.12r93733
    Ubuntu 14.04 updated 8/30/2014

    Maybe there should be a PPA or some hefty scripts to do these very common activities? I would be willing to help with documenting and automating the Win7 Host and Ubuntu 14.04 VM environment.

    The shortcut keys (below URL, techdriven) are vital. The default 14.04 desktop allows you to auto hide the start bar, but doesn’t sense the mouse to unhide it. And just try assigning your USB mouse adapter (on the host) to the VM (no-don’t, really). The shortcuts can save you. If you haven’t accidentally disabled your keyboard or display, pressing and holding down the Win key will bring up the menu of shortcut keys.

    Many thanks to:

  3. Thanks! This worked great. BTW–this also works equally well on Linux Mint 17.

  4. This looks like a near perfect way to run network backups of steel devices from a central Ubuntu server. I simply need to get comfortable with storing Windows share credentials in a file on Ubuntu. It will surely require a separate, non-interactive userid that has no priv on any machines.

    Other thoughts include making a Windows mapped network drive to the Ubuntu partitions. This still allows me to run Ubuntu-centric backups that catch the Windows boxes, but requires either Windows backups to the mapped drive or automated batch files running xcopy to the mapped drives. Additional complexity is rarely good.

    Virtual devices of any OS will of course run on the Ubuntu and be easily backed up.

    Thank you.

  5. How do you prevent failed mounts caused by spinup delays? If i reboot my ubuntu server while my unraid disks are spun down it fails to mount. I have to manually run sudo mount -a afterwards to get them back.

  6. Thanks.
    I’ve been struggling for a while to solve this issue, so it was great to find a post that gave such clear instructions.
    Works on Mint 17 Cinnamon accessing shares on a Synology DS213j server.

  7. Thanks !!!!!
    Ok to mount NAS server’s shares on my Ubuntu 14.10
    No, it’s not an utopia.

  8. Still no luck mounting my readySHARE. I keep getting the mount error(22): invalid argument message. Ehh, whatever, diving back into google.

  9. anyone please help!!! I tried mounting the network drive. I think everything worked till the last step, where it is asked to mount the drive using the command sudo mount -a. but on doing that, i get an error message like this.

    mount error(13): Permission denied
    Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

    I am very new to using ubuntu and I really need help in this!!!


    • Try adding below line into the /etc/fstab file, adds sec=ntlm, username and password.

      //servername/sharename  /media/mountpoint  cifs username=msusername,password=mspassword,iocharset=utf8,sec=ntlm  0  0

      Take a look at this:

    • I had the same issue and adding “sec=ntlm” did the right thing.
      This is the complete line added to the fstab file (of course it contains my own server details, so you need to adapt it to your):

      // /media/ceres/Data cifs sec=ntlm,credentials=/home/ceres/.smbcredentials,iocharset=utf8,gid=1000,uid=1000,file_mode=0777,dir_mode=0777 0 0

      If it does’t work try other security options:
      Security mode. Allowed values are:
      · none – attempt to connection as a null user (no name)
      · krb5 – Use Kerberos version 5 authentication
      · krb5i – Use Kerberos authentication and forcibly enable packet
      · ntlm – Use NTLM password hashing
      · ntlmi – Use NTLM password hashing and force packet signing
      · ntlmv2 – Use NTLMv2 password hashing
      · ntlmv2i – Use NTLMv2 password hashing and force packet signing
      · ntlmssp – Use NTLMv2 password hashing encapsulated in Raw NTLMSSP
      · ntlmsspi – Use NTLMv2 password hashing encapsulated in Raw
      NTLMSSP message, and force packet signing

      • Hi,

        I already use every recommendation posted here and on the suggested webpages for mounting a hdd on the working net. I’m using ubuntu 14.04. However, it seems noting is working, it’s still appearing mount error (115). I even try to solve it, but I really don’t know what’s happening. Please, can somebody help me?

        thanks :)

  10. Very nice guide, however when ending by mounting I get this

    salle@TopGun:~$ sudo mount -a
    [sudo] password for salle:
    Password for root@//
    mount error(13): Permission denied
    Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
    mount: mount point 0 does not exist

    The post about adding the credentials to fstab did not work, the same output occours.

    Thx in advance.

  11. Hello. Thanks for your help but when I run:

    sudo mount -a

    in the terminal I get this reply:

    Unable to find suitable address



  12. This worked perfectly until a few days ago. Suspect some behind the scenes “update” screwed things up. All modification to files per your instructions are still there, but the thing just doesn’t mount, at startup, or with the mount -a command. Any ideas?

  13. Excellent! Thanks!

  14. When I run

    sudo mount -a

    in the terminal I get this reply:

    Unable to find suitable address

  15. A week or two ago I installed a Canan MX890 successfully on my first Ubuntu sytem (14.04). I am now trying to install the same printer on another Ubuntu 14.04 system and have been getting the following error:

    Failed to fetch ‘’ 404 Not Found.

    Is your repository down or could this error be my fault? I’m very new to Ubuntu and wouldn’t know how to troubleshoot this myself.


  16. how to give certain letter like”h” to this mount

  17. Just gonna wade in for those of you with spaces in the share you’re trying to mount.

    In my case a Seagate NAS box labeled ‘Goflex Home Public’…
    i had to use 40 in place of the spaces…


    40 is a space in fstab


    • I had to use 40…


      // /media/nas cifs credentials=/home/gary/.smbcredentials,iocharset=utf8,gid=1000,uid=1000,file_mode=0777,dir_mode=0777 0 0

      • The post didn’t keep exactly the syntax I used.

        Let me try to show it between quotation marks…

        Use ’40’

        Like this: GoFlex’40’Home’40’Backup (except you must remove the quotes when you add this to your /etc/fstab file.

        I wanted to share this with others, because I have been looking for this solution for two years!! Thank you so much for this post.

  18. Hi,
    I wonder what is the output of ls -al on any of your CIFS shares mounted like above? On my NAS share mounted like this:
    //srv/share /mnt/share cifs credentials=/root/.smbcredentials,rw,nounix,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0

    the files and dirs are all root owned (even when I create them as a user) with all rwx bits set, so konsole shows something not very usefull. I wonder if there could be done something to better deal with perms etc on CIFS?

    Maybe NFS is more friendly?

  19. Ji m: This article solved Ubuntu issues I have been struggling with for months. I just mapped a Windows machine and two network/modem drives. Thank you very much!!!

  20. This was enormously helpful, and incredibly simple; many prior attempts had failed. Thank you!

  21. Hi, thanks for the infos, sec=ntlm helped me a bit further. But I’m sticking with the permissions, too. I can’t modify data on the server. With former Versions of Ubuntu, I used uid= and gid=, but this doesn’t seem to work anymore. How do I set a uid/gid for propper permissions on the NAS??

  22. thanks, this worked beautifully.. the last time I mapped a network drive in Ubuntu 12 it took me several days to figure it out.. you made it much faster, thank you ;-)

    I did get the ‘Unable to find suitable address’ error, in my case it was because the IP address of the network drive had changed since the last time I tried it. Correcting that fixed the error.

  23. Another thing that I’ve found useful is adding the -v (verbose) switch to the mount command in the last step to get a bit more information when it isn’t working quite right. I was finding that mount appeared to have run, but was actually saying that the location was already mounted so it wasn’t actually applying any changes I had made to my fstab file. (I had it mounting read-only and I was making changes to fstab but nothing worked because it actually wasn’t being re-applied!)

  24. Thank you so much…I work with digikam doing lots of photo management and my photo library is on my blackarmour seagate NAS 220 attached to my router and everytime I want to open digikam I have to navigate to the NAS and mount it. But now digikam thinks it’s a local library and it find it everytime. Thank you so much

  25. If I wanted to add a second mounted smb, would I have to do the entire process over? or could I just add a second line to the fstab file?

  26. deplorable guide because of insufficient prerequisites stipulated

  27. Hi, Thanks.
    Works fine on LinuxMint 17.1.
    Perfect well explained.

  28. Thanks works great!! Only isn’t it insecure to place your password in a txt file?

    • #Danny

      that’s exactly what I was thinking…
      I stopped right after I saw instruction to enter my cred in that file…

    • instead of “credentials=/home/handbook/.smbcredentials,iocharset=utf8,gid=1000,uid=1000,file_mode=0777,dir_mode=0777 0 0” i just did “guest 0 0” since my shared drive is on a private network, so the shared drive doesnt need credentials. if you use “guest 0 0” you dont need to create the credential txt file.

  29. Really well written and just what I was looking for. Thanks for all your efforts.

  30. Works brilliantly – thanks so much for the clear instructions

  31. Hi,

    I tried your instructions to map network drive unto ubuntu 14.04. Unfortunately, after executing the command sudo mount -a, I am getting the following error message:

    mount error(115): Operation now in progress
    Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

    Can you please help me in this regard,

  32. THis worked great on both the windows desktop with in a VM and a VM running on my MAC Book as long as i used the 32 bit version of Ubuntu. If i used the 64 bit the instructions fail because of the way that it wants you to initialize cifs. I kept getting an error and was directed to read the mount.cifs man page.

    I am sorry and did not note the exact error and I have removed the 64 bit version.

  33. Good Article.. Say if we want to auto mount network map drive only in particular user login then what to do?

  34. Hi – I do have a recurring error that baffles me, but I want to start off by saying that this is a great article, clear and easy to follow after grinding through days of googling into many “newbie unfriendly” articles ahead of yours.

    The error is “error(6) no such device or address” refer to the mount cifs(8) manual page”

    Can’t make sense of anything about it on google searches.

    My systems: ubuntu server 14.04.3 headless, Windows 8.1 Pro (legit) – trying to map over a network drive to be able to send folder backups via DirSyncPro

    I did have to sort out the directories for the .credentials file prior to this error, as my user is root, but it is located now, and I can’t help but wonder if the problem originates back at the server address – is there something about “share” I’m not cluing in on?

    // /media/Windows-Backups/RHD cifs credentials=/root/[myusername]/.smbcredentials,iocharset=utf8,gid=1000,uid=1000,file_mode=0777,dir_mode=0777 0 0

    All of the upper/lower cases are appropriate in my folder and names. Its all one line.

  35. Fixed the device issue, but hours of checking and adjusting the dirs and uid gid etc etc, and making sure its windows ip, I just can’t get past the “permissions” file permissions are now “owner rw” (0600)

    Like the article otherwise

  36. Thanks so much for the tutorial. I got this working for one would you go about doing this for two or more?

  37. Thanks for great tutorial. I have the error
    Retrying with upper case share name
    mount error(6): No such device or address
    Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

    I have tried all the hints suggested and have tried :smbclient -L //bananapipro -U pi
    where I received this
    Domain=[WORKGROUP] OS=[Unix] Server=[Samba 4.1.17-Debian]

    Sharename Type Comment
    ——— —- ——-
    IPC$ IPC IPC Service (bananapipro server)
    pserver2 Disk storage
    PISERVER Disk storage
    Domain=[WORKGROUP] OS=[Unix] Server=[Samba 4.1.17-Debian]

    My fstab is this
    // /media/PSERVER cifs credentials=/home/ben/.smbcredentials,iocharset=utf8,sec=ntlm,gid=1000,uid=1000,file_mode=0777,dir_mode=0777 0 0

    Sorry for the bother

  38. Hi Ji,

    A nice and clear tutorial. Thanks. I was looking forward to having a permanently mapped network partition. For some bizarre reason I am seeing the message when attempting to mount the share:

    Unable to access “Steven-share”

    [mntent]: line 14 in /etc/fstab is bad
    mount: can’t find /media/Steven-share in /etc/fstab or /etc/mtab

    even though the directory ‘Steven-share’ is clearly created and accessible at /media.

    It makes no sense to me. I wonder if you have any thoughts?

    • Hi Ji,

      I managed to identify one of the issues. Now I see the following message when trying to mount the partition:
      Unable to access “Steven-share”
      mount: only root can mount // on /media/Steven-share

      Any thoughts?

  39. THANK YOU!!
    I’ve successfully mounted NSA310s without any problems.
    Great tutorial !!

  40. Thank you so much for this article. Exactly what I needed and worked perfectly. Must admit that I don’t understand all of the commands, but happy to have the step-by-step instructions. Screen shots really helped see the exact text. Works great with Mint!

  41. Hi Ji,

    Would this same procedure still work in Ubuntu 16.04 or are there differences?

    Do I really need to install libnss-winbind since your examples always specify the Server IP and not its Wins Host name?

    I assume this process will automatically mount these network shares the next time i restart as long as the sudo mount -a does not return any permissions errors and my Win 10 server shares are available?

    I’m kind of new to Ubuntu but I’ve played around with older versions (13.04, 14.04, & 15.04) and now 16.04 on a spare laptop. However, I’ve never tried to map network shares on my Win 10 Pro 64-bit that is setup as my Home Media & Backup Server. I did install cifs-utils and was able to open the Files app and find my Win 10 Server and mount my Shares with a local account on my Win 10 server. The only app that had a problem opening and writing files to these shares was OpenOffice 4.1.2 (removed Libre Office). It caused Gnome Virtual File System (gvfs) error. I was wondering if you think the process might fix my issue with OpenOffice?

    Any advice for doing this on Ubuntu 16.04 would be greatly appreciated! Thanks!

    • I followed your procedures in Ubuntu 16.04 and they worked perfectly! They even fixed the gvfs permissions errors I was getting with OpenOffice trying to open files on my Windows Shares. Now OO can open the file, setup its lock file, change the file, and save on my Win Share. I am a software engineer, but new to the Ubuntu Linux world and trying to read through all the smb/cifs/gvfs manuals can be quite a task. Thanks so much for the detailed information to help simplify the process!

  42. Thanks, very useful tutorial, worked at the first try also in Debian 8!
    A little point I miss is the setting of ~/.smbcredentials file’s permission, to protect the password. I think it should be 600 (“chmod 600 ~/.smbcredentials” command).

  43. Thank you Ji,
    I followed these steps pretty much exactly, received several error messages along the way, but managed to mount a Drobo5N share using Ubuntu 16.04 LTS. Now I can backup my Ubuntu server quite easily. Previously, I had tried to back up to the Drobo as a network drive and kept getting “back up files are corrupted, erase and restart” error messages.

  44. Yuri Weinstein June 2, 2016 at 9:28 pm

    I followed all steps and was able to mount my network drive with “cifs”.
    However it does not autoconnect on reboot. Any suggestions?

  45. Thanks Ji, nice walkthrough – however I am having a problem; when I try to mount the drive through nautilus it comes up with error:
    mount: only root can mount smb:// on /media/******
    Can you advise what I may be doing wrong?

  46. Lasse Stalung June 27, 2016 at 2:35 pm

    I need to mount 4 samba shared folders from my ubuntu server on my backup server. The first one worked perfect using your sample, but after adding the 1 to 3 more shared folders the reboot process stalled.

    I want to mount 4 samba shared folders from my ubuntu server on my backup server. The first one worked perfect, but after adding the 3 others reboot process stalled.

    I will use you sample data to explain what I have done:

    I created 4 mount points:

    sudo mkdir /media/Ji-share1
    sudo mkdir /media/Ji-share2
    sudo mkdir /media/Ji-share3
    sudo mkdir /media/Ji-share4

    Edited the /etc/nsswitch.conf to:
    hosts: files mdns4_minimal [NOTFOUND=return] wins dns

    I made one user credentiols;


    I aded this 4 lines to the fstab:

    // /media/Ji-share1 cifs credentials=/home/handbook/.smbcredentials,iocharset=utf8,gid=1000,uid=1000,file_mode=0777,dir_mode=0777 0 0
    // /media/Ji-share2 cifs credentials=/home/handbook/.smbcredentials,iocharset=utf8,gid=1000,uid=1000,file_mode=0777,dir_mode=0777 0 0
    // /media/Ji-share3 cifs credentials=/home/handbook/.smbcredentials,iocharset=utf8,gid=1000,uid=1000,file_mode=0777,dir_mode=0777 0 0
    // /media/Ji-share4 cifs credentials=/home/handbook/.smbcredentials,iocharset=utf8,gid=1000,uid=1000,file_mode=0777,dir_mode=0777 0 0

    The 4 Samba share on were named: share A, share B, shareC and shareD.

  47. Thanks! It’s an old post but still working perfect!

  48. To edit the fstab by running the command:

    sudo gedit /etc/fstab

    I don’t see anything. why is it?

  49. Thank you very much. It works fine on PI running ubuntu mate.

  50. This was exactly what I need to mount a shared USB drive on my router between my various machines, including a new Linux Mint18 install. Thanks so much!

  51. Thanks for the instructions….
    I thought I followed your instructions to the letter but when I run sudo mount -a I get this error…
    only root can mount // on /media/TS453Pro-share

    Please help… I am going nuts trying to sort this mounting stuff out.

  52. OK, odd question….what if I wanted to undo all that? What would I do

  53. Hi all!
    Thanks for the instructions! It all worked like a charm, until today…

    I need some help!

    When I try to access the folder the systems throws an error: “Cannot display the contents of the folder” Not authorized…

    Very strange, since it is just ‘out of the blue’ (nothing has changed)

  54. What’s missing here is securing the .smbcredentials file.
    Simply run:
    chmod 600 ~/.smbcredentials

  55. Works perfectly 3 years after posting! Thank You!!

  56. I’m really not a fan of having the smbcredentials in clear text on the computer; it would be better if they were in some sort of key-ring (which is why I usually use gvfs). It’s not the worst on a personal machine, but I’d really like to avoid any clear text passwords saved on work machines.

    But recently I found libpam-mount. The guide is a bit out of date (you’ll have to add “nosuid,nodev” to the options= parameter or it’ll complain about required options missing) but works great if your login password matches your CIFS password (which is the case at our workplace, since we use LDAP for both the machine and the network.