Monthly Archives: December 2009

Mounting a Windows Share on Linux

Ubuntu

Mounting a Windows Share

In this instance the connection to the Windows share is from a Ubuntu server. Open terminal on your Mac and connect to the server you wish to mount a new drive on:

ssh -p 8888 user@stagingserver.isd.domain.ac.uk

Change Directory to ‘etc’

cd /etc

Then open fstab using the VI editor:

sudo vi fstab

Add a new line to the file:

//servername/share /mnt/share smbfs user,credentials=/etc/samba/cred-file,uid=user,gid=users 0 0

The key values here are:

(server/share) (mount point) (File System) (Options)

The mount point must exist:

cd /mnt

sudo mkdir share

sudo chown user:user share

This will create a new directory named “share” and grant ownership to “user”

Next install Samba and smbfs using aptitude

sudo aptitude install smbfs

sudo aptitude install samba

Change directory to /etc/samba and create the credentials file:

cd /etc/samba

sudo touch cred-file

sudo vi cred-file

Add windows user credentials to the file:

username=domain/user password=blahblah

Now remount all directories in the fstab file using:

sudo mount -a

To view information on the current mount’s run:

df -h