A man will die, but not his ideas.

Wednesday, December 27, 2006

Auto-Mounting Windows Shares in Ubuntu 6.10

OK, I finally managed to have Ubuntu running on my PC. And just so that no body jumps to conclusions, the issue was not resolved. I downloaded Edgy Eft Desktop CD and re-installed Ubuntu. Of course, I had to start configuring everything back the way it was. I have two NICs and share my Internet connection with my brother's PC via Firestarter. And among the things that I needed to configure was accessing the shared folders on his PC which was running Windows only. In order to not forget the process once again, and help others who might be looking for how to perform this, I'm listing the process here.

First, we need to install the smbfs package via apt-get or Synaptic. By the way, smbfs is not smbclient. Then we should create a file containing necessary credentials for accessing the shared folder. You could name the file anything you like (e.g. cred, smbcred, or sambapass). The file should contain the following fields:

username = windowsuser
password = windowspassword

You can use gEdit for editing the file. And by the way, in my case, I left the password and domain fields empty since they are not applicable.

Next, decide where you would like the shared folders to be mounted. I created a folder named "mounts" in my home directory and created a sub-directory for each shared drive on my brothers PC. Finally, we need to edit /etc/fstab so that we don't have to perform the mounting process every time we boot the machine. Before doing so, it is advisable that you create a backup copy of the file just in case.

In order to edit the file, you need to have root privileges. Thus, you could for example run gEdit via gksudo and provide the password. After that, you could open the fstab file from within gEdit and be able to edit its contents. What you need to add is a line for each shared drive/folder specifying were it should be mounted, file system type, what credentials are necessary for accessing the share, and setting the owner and group for all files in the share. For example:

// /home/informer2000/mounts/sliders-2_c smbfs credentials=/home/informer2000/sambapass,uid=informer2000,gid=informer2000 0 0

Please note that there should be no line breaks in the line (i.e. all the above should be in one line). Now, all you have to do is save the fstab file, open the terminal and type sudo mount -a and if everything went well you should be able to access the shares from the directories at which they are mounted. In addition, the mounting command is not required after that because they will be mounted automatically when Ubuntu starts.

Labels: ,

Posted by A :: 3:13 PM :: 2 Comments:

Post / Read Comments


Creative Commons License
Unless otherwise expressly stated, all original material of whatever nature created by the blog's author and included in the "A man will die, but not his ideas." weblog and any related pages, including the weblog's archives, is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.

* Java and the Java Coffee Cup Logo are trademarks or registered trademarks of Sun Microsystems,Inc. in the U.S. and other countries.