Mounting Windows Share using smbfs in Kubuntu

On my new Kubuntu box, I wanted to mount my “My Documents” folder that resides on a Windows Server 2003 R2 box. I have always had problems mounting folders due to the nature of Active Directory.

In KDE you can easily mount a share using the built in wizard, but I wanted to mount it as folder so I could access it using command line. First thing to do is install smbfs.

sudo aptitude install smbfs

Next thing we want to do here is make a folder to mount this remote location. I’m going to make it in the /media folder.

sudo mkdir "/media/My Documents"

The quotes are there to allow spaces in the directory name.

After that is this interesting line. If the share your connecting to  has any spaces in the name, you will need to put that option in quotes. Here is my complete line.

sudo mount -t smbfs -o username=blake,password=PASSWORDHERE "//server/UserData/blake/My Documents" "/media/My Documents"

I have made this into a script so I can easily run it when I need to connect.

I hope this has helped you getting your Linux box talking to your Active Directory protected share.