{"id":3779,"date":"2014-08-11T14:10:09","date_gmt":"2014-08-11T14:10:09","guid":{"rendered":"http:\/\/ubuntuhandbook.org\/?p=3779"},"modified":"2024-04-22T10:01:23","modified_gmt":"2024-04-22T10:01:23","slug":"map-network-drive-onto-ubuntu-14-04","status":"publish","type":"post","link":"https:\/\/ubuntuhandbook.org\/index.php\/2014\/08\/map-network-drive-onto-ubuntu-14-04\/","title":{"rendered":"How To Map A Network Drive Onto Ubuntu 14.04 Permanently"},"content":{"rendered":"<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/08\/map-network-drive.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3780\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/08\/map-network-drive.png\" alt=\"Map Network Drive\" width=\"235\" height=\"235\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/08\/map-network-drive.png 235w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/08\/map-network-drive-150x150.png 150w\" sizes=\"auto, (max-width: 235px) 100vw, 235px\" \/><\/a><\/p>\n<p>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.<\/p>\n<p><b>UPDATE-2024: This tutorial is outdated, and no longer works in current Ubuntu releases!!<\/b><\/p>\n<p>All things will be done in a terminal window. Not familiar with Linux command? Don&#8217;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.<\/p>\n<p><b><span style=\"text-decoration: underline;\">Preparation:<\/span><\/b><\/p>\n<p>There are a few preliminary actions we need to do before we can start mounting using cifs.<\/p>\n<p>1. Press <b>Ctrl+Alt+T<\/b> on keyboard to open the terminal. Paste the command below and run to create a mount point, you can replace &#8216;Ji-share&#8217; to what you want.<\/p>\n<pre style=\"border: none;\">sudo mkdir \/media\/Ji-share<\/pre>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/08\/create-mount-point.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3781\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/08\/create-mount-point.png\" alt=\"Create a mount point for network share\" width=\"503\" height=\"132\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/08\/create-mount-point.png 503w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/08\/create-mount-point-300x78.png 300w\" sizes=\"auto, (max-width: 503px) 100vw, 503px\" \/><\/a><\/p>\n<p>2. Install <code>cifs-utils<\/code>, which provides support for cross-platform file sharing with Microsoft Windows, OS X and other Unix systems.<\/p>\n<p>Install it from Ubuntu Software Center, or via below command:<\/p>\n<pre style=\"border: none;\">sudo apt-get install cifs-utils<\/pre>\n<p>3. Edit the \/etc\/nsswitch.conf:<\/p>\n<pre style=\"border: none;\">sudo gedit \/etc\/nsswitch.conf<\/pre>\n<p>Find the line looks like:<\/p>\n<blockquote><p>hosts: files mdns4_minimal [NOTFOUND=return] dns<\/p><\/blockquote>\n<p>change it into:<\/p>\n<blockquote><p>hosts: files mdns4_minimal [NOTFOUND=return] <span style=\"color: red;\">wins<\/span> dns<\/p><\/blockquote>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/08\/ubuntu-resolve-windows-hostname.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3782\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/08\/ubuntu-resolve-windows-hostname.png\" alt=\"Ubuntu resolve Windows Hostname\" width=\"600\" height=\"321\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/08\/ubuntu-resolve-windows-hostname.png 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/08\/ubuntu-resolve-windows-hostname-300x160.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>4. Run below command so that your Ubuntu can resolve Windows computer name on a DHCP network.<\/p>\n<pre style=\"border: none;\">sudo apt-get install libnss-winbind winbind<\/pre>\n<p>Reboot Ubuntu, or restart your network.<\/p>\n<p><b><span style=\"text-decoration: underline;\">Mount (map) network drive:<\/span><\/b><\/p>\n<p>Now edit the fstab file to mount network share on start up.<\/p>\n<p>1. Make a backup by running the command below:<\/p>\n<pre style=\"border: none;\">sudo cp \/etc\/fstab \/etc\/fstab_old<\/pre>\n<p>If you need to restore your backup, run:<\/p>\n<pre style=\"border: none;\">sudo mv \/etc\/fstab_old \/etc\/fstab<\/pre>\n<p>2. Create a credentials file via:<\/p>\n<pre>gedit ~\/.smbcredentials<\/pre>\n<p>insert the username and password for accessing the remote share. <span style=\"color: red;\">Replace &#8220;Ji&#8221; &amp; &#8220;741852963&#8221; with yours<\/span> and save the file.<\/p>\n<blockquote><p>username=Ji<br \/>\npassword=741852963<\/p><\/blockquote>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/08\/create-credentials.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3892\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/08\/create-credentials.jpg\" alt=\"create-credentials\" width=\"580\" height=\"285\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/08\/create-credentials.jpg 580w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/08\/create-credentials-300x147.jpg 300w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<p>3. Run command to get your gid and uid. Replace <span style=\"color: red;\">handbook<\/span> with your user name.<\/p>\n<pre style=\"border: none;\">id <span style=\"color: red;\">handbook<\/span><\/pre>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/08\/get-user-id.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3784\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/08\/get-user-id.png\" alt=\"Get Ubuntu user id\" width=\"516\" height=\"125\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/08\/get-user-id.png 516w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/08\/get-user-id-300x72.png 300w\" sizes=\"auto, (max-width: 516px) 100vw, 516px\" \/><\/a><\/p>\n<p>4. Now edit the fstab by running the command:<\/p>\n<pre style=\"border: none;\">sudo gedit \/etc\/fstab<\/pre>\n<p>Add below line (one line) to the end and save it. REPLACE WORDS IN RED!<\/p>\n<blockquote><p><span style=\"color: red;\">\/\/192.168.1.5\/share<\/span> \/media\/<span style=\"color: red;\">Ji-share<\/span> cifs credentials=\/home\/<span style=\"color: red;\">handbook<\/span>\/.smbcredentials,iocharset=utf8,gid=<span style=\"color: red;\">1000<\/span>,uid=<span style=\"color: red;\">1000<\/span>,file_mode=0777,dir_mode=0777 0 0<\/p><\/blockquote>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/08\/map-network-share.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-3785\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/08\/map-network-share-300x187.jpg\" alt=\"Map Network Share in Ubuntu\" width=\"300\" height=\"187\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/08\/map-network-share-300x187.jpg 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/08\/map-network-share.jpg 956w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Finally run <b>sudo mount -a<\/b> in terminal and you&#8217;ll get the network share mapped in Unity Launcher and Nautilus file browser:<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/08\/mapped-network-share.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3786\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/08\/mapped-network-share.jpg\" alt=\"Map network share Ubuntu 14.04\" width=\"600\" height=\"389\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/08\/mapped-network-share.jpg 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2014\/08\/mapped-network-share-300x194.jpg 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>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&#8217;t be afraid, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[1132,855],"class_list":["post-3779","post","type-post","status-publish","format-standard","hentry","category-howtos","tag-map-a-network-drive","tag-ubuntu-14-04"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/3779","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/comments?post=3779"}],"version-history":[{"count":0,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/3779\/revisions"}],"wp:attachment":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media?parent=3779"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/categories?post=3779"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/tags?post=3779"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}