Wednesday, November 12, 2008

Mounting Windows Shares Using CIFS on Ubuntu

So you have a cool Buffalo LinkStation Pro Duo or a Windows machine with some shared folders you want to access from your super Linux machine. No problems we have CIFS to the rescue!!

These instructions were tested in Kubuntu 8.10 (Ibex) but shall work with previous versions and future versions of Kubuntu and/or Ubuntu. Also I assume you want the share to be available to all users in the system so you need root access (i.e. sudo).

First install smbfs package:


sudo aptitude install smbfs


Create a directory were you want to mount the shared folder, any place is ok:


sudo mkdir /media/share


If the share requires username and password to access create a password file in you home directory:


sudo echo -e "username=my_username\npassword=my_password" > /root/.share_pass
sudo chown root:root /root
sudo chmod 700 /root/.share_pass


Replace "my_username" and "my_password" with the corresponding user and pass to access the remote share.

Finally create an entry in the "/etc/fstab" file to mount the shared folder in the desired mount point:


//ip-address/share /media/share credentials=/root/.share_pass,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0


Here you must replace //ip-address/share with the ip address of the machine with the shared folder and the complete path to the respective folder.

Finally mount all partitions:


sudo mount -a


Now you must be able to access the shared folder at the remote machine by accessing the /media/share directory.


References



http://ubuntuforums.org/showthread.php?t=288534