How to mount network share in ubuntu

Status
Not open for further replies.

MyGodAL3X

In Runtime
Messages
460
Location
Ottawa, ON, Canada
Hey all,

I had trouble finding a how to that covered this and worked properly for me, you should note that this is for a share that is made on a Linux system, not a windows share.
So here is what worked for me.
In this how to, whatever I right in caps is information that you can change to suit your particular preferences or the name of your share/server.

So you will need to do everything from the terminal.

So you will need to install the smbfs, which is a bunch of internet files system package, you do so by typing:

sudo apt-get install smbfs

And then putting in your admin's password.

After that you will want to create a mount point for the drive, I suggest doing it in /media, that way it will appear on your desktop, just like when you put in a CD/DVD. So type:

sudo mkdir /media/SHARE

Next, you will want to create a file that contains the username and the password of the user that has access to the share. You can save it where you want, as long as you do not move it, since you will need its path later. In this example I created a directory and a file within my home directory. So type:

sudo gedit /home/YOURUSERNAME/.credentials/SHARE_CREDS

Inside this file you will want to put your info in this format:

username=SHAREUSERNAME
password=SHAREUSERPASSWORD

Then you will want to edit the fstab, which is the file that will mount your shares on every boot.

sudo gedit /etc/fstab

Inside fstab you will want to put this line and save afterwards, making sure everything is properly typed and points to the right thing, for YOUSERVER I recommend using your server's IP address, it makes it easier:

//YOURSERVER/YOURSHARE /media/SHARE cifs credentials=/home/YOURUSERNAME/.credentials/SHARE_CREDS 0 0

Save fstab and then run this command in terminal:

sudo mount -a

If any errors popped up, I am sorry leave them in the comments below and I'll try to help.
If everything worked fine, then you are all set. You can do a reboot to make sure it comes back but it will.

Hope this helps.

Cheers.
 
Status
Not open for further replies.
Back
Top Bottom