Saturday, August 7, 2010

Debian: How to mount a windows samba share

A couple of days ago I was trying to use file space that my university provides on my laptop running debian linux. This guide does not only apply for the so-called "H: drive" of Imperial College but for all windows shares.

First of all, you need to install the following packages: smb-client and smbfs. Create a directory in your home directory that will be used for mounting the samba share. (mkdir ~/samba)

Then edit the /etc/fstab file by adding a row like this:

serverURL mountPoint smbfs username=XXXX,user,noauto 0 0

The username=XXXX part is for logging in to the remote sever. If no login is requred then it can be ommited. The user option allows for mounting the directoy without root privileges and noauto specifies that it won't be mounted automatically during startup.
The line should look like this:

//server/myDirectory/ /home/antonis/samba smbfs username=XXX,user,noauto 0 0

Then you can mount the directory using mount ~/samba. If a password is required you will prompted to type it. Once done unmount it by: umount ~/samba

Note: to access you Imperial H drive you should use the VPN service.

No comments: