Mounting a Windows share folder in Ubuntu

I have been connecting to my home folder at the Universitiy of Oslo for quite some time now, and since they use the Windows file-sharing protocol for this purpose, there has been room for quite som headaches.

After some googling I was able to figure out how to connect and mount a folder temporarily, but I had to re-mount it with my password every time I rebooted the computer. Finally, after realizing I actually tried this when I first figured the temporary method, I am now able to mount it permanently. I'll show you how, in just a few, simple steps:

First of all, we need to install the samba file system. Type the following in to a terminal:

``` {lang="bash"} sudo apt-get install smbfs

Next, we need to get our username and password ready. Type the following
into a terminal while replacing \[your username\] with your username:

``` {lang="bash"}
gksudo gedit /home/[your username]/.smbcredentials

In the new file, add the following while using your own username and password:

``` {lang="bash"} username=[your username on the windows (smb) server] password=[your password on the windows (smb) server]

Close the file, and type the following in to your terminal:

``` {lang="bash"}
sudo mkdir /media/sambamount
sudo cp /etc/fstab /etc/fstab.backup
sudo gedit /etc/fstab

We have now made a backup of the current fstab (the file managing your mounted file systems) and opened it for editing. Add the following line to the file while substituting the brackets with your own values:

``` {lang="bash"} //[server name or DNS]/[folder on server to mount] /media/sambamount cifs credentials=/home/svenni/.smbcredentials,uid=[your local username],gid=users,iocharset=utf8 0 0

Save and close the file.

Everything should now be ready for the directory to be mounted when you
boot the computer, but you could test it before you have to close the
browser and take a two minute break away from your precious desktop.

Type the following into your terminal to test the mount:

``` {lang="bash"}
sudo mount -a

Your shared windows directory should now appear on the desktop as a hard drive icon with the name Ā«sambamountĀ».