Linux Terminal – How to Map a Drive Network Share

linuxnetwork-sharesterminalUbuntu

Still getting used to Linux, and the GUI is great. I have Ubuntu 10 and I can go to Network and see the Windows network. Then double clicking this gets me to the drives that are shared. Then when I go back to the terminal and use:

cd ~/.gvfs

I can see the mapped drives. But it would be nice if I could this without all the mouse clicking. So how do I map network drives in the terminal, something akin to net use for Windows.

EDIT: Not sure what happened, but this is what I did to get it to work. I created the directory for the share in /media and then ran:

sudo mount -t cifs -o username=nicorellius //server/share/ /media/share

and it said command couldn't be found. So i thought I would go ahead and use smbfs so I ran:

sudo apt-get install smbfs

I tried the command suggested with smbfs instead of cifs and that didn't work either. So I tried again and then the next time I ran:

sudo mount -t cifs -o username=nicorellius //server/share/ /media/share

it worked and I could navigate to the directory with cd.

Best Answer

Create a directory on your machine to use as a mount point for the share:

sudo mkdir /media/yoursharename

Then use the mount command to map a Windows share to the mount point you just created:

sudo mount -t cifs -o username=nicorellius //server/sharename /media/yoursharename

You should now be to access the share from your /media/yoursharename mount point.

Related Question