How To Automatically Mount A Network Share In Ubuntu
Mounting a shared drive in Ubuntu can be quite a confusing process. With many of us having multiple machines and NAS drives at home, auto mounting network locations is becoming a very common requirement in most homes and offices. I have a NAS drive at home that I use for multimedia and I make Ubuntu auto mount the NAS as soon as I log on. Here’s how I do it:
First of all you need to run this command in terminal:
sudo apt-get install gvfs-bin
Then, once the application is installed you need to paste the text below into a text editor window and then save it as .ShareMount.sh in your home folder. The file name needs to be exactly the same, it’s case sensitive and requires the dot at the start of the name.
gvfs-mount smb://%Path_to_share%
NOTE: Where “%path_to_share%” is listed this will be replaced with the actual share path. So, if there is a share called ‘share’ on computer01 then the actual command would be gvfs-mount smb:computer01/share
Once you have your .ShareMount.sh file in your home folder (you may have to press ctrl+h to show hidden files in order to see it) right click on it, select properties and then within the permissions tab select the “Allow executing file as program” check box.
Now, double click on the file and select the run button. You should now see the share mount within Ubuntu – this means that our script is working.
The only thing left to do now is create a new start up item so that the scripts runs when you log in. To do this, click on the dash and search for “start” then open Startup Applications. Click the add button and fill it in the fields exactly as shown below:
Name: Share Mount
Command: /home/<username>/.ShareMount.sh
Comment: This will mount my share on boot.
In the command section, please ensure that you replace <username> with your exact username. If you don’t know this you can find this out by opening terminal. The prompt in terminal will say <username>@<computername>:~$. So the bit before the @ symbol is your username.
That’s it. All you need to do now is reboot your machine to test that it works. Not quite as simple as Windows but simple nonetheless. You also learnt how to make a basic script. :)
-
Dominik M
-
https://refu-archive.kevquirk.com/ Kev Quirk
-
Anupal
-
-
-
Patch
-
Andrew McGlashan
-
https://refu-archive.kevquirk.com/ Kev Quirk
-
Andrew McGlashan
-
https://refu-archive.kevquirk.com/ Kev Quirk
-
-
-
http://twitter.com/solodg Kevin Bessey











![Half-Life & Counter-Strike Now Available On Linux [Beta]](/wp-content/uploads/2012/07/Steam_Logo-252x150.png)














