Ubuntu and mount.cifs

Using SMB/CIFS under Nautilus was too slow. For Windows shares that I use regularly I figured it would be faster and easier to have the share mounted permanently as part of the file system. This also has the benefit of all Linux programs being able to access the files, not just Gnome based apps. Here is how I mounted a R/W Windows share under Linux.

My experience with Samba is that getting it to work properly varies from installation to installation, so your mileage may vary. More information on CIFS under Linux can be found here: http://linux-cifs.samba.org/

Next we need to create the folder on the local file system that mount.cifs will use. With Ubuntu, you can create the folder where mount puts things like CD-ROMs and USB flash drives (/media), and using the same name as your Windows server share:

sudo mdkir /media/sharename

You will also want to give this folder permissions so that regular users can read/write to the folder:

sudo chmod 777 /media/sharename

or if you want to be a little more paranoid:

sudo chown root.somegroup /media/sharename

sudo chmod 770 /media/sharename

where “somegroup” is a group that contains the users who needs access to this share. This is partly what will allow you to access the mounted share as R/W. Running the command ”
ls -l /media” should show your permissions as follows:

drwxrwx— 2 root somegroup 4096 2008-05-21 09:04 sharename

OK, now we have to pass the credentials to the SMB/CIFS server but we don’t want to put the username/password into the fstab file, so we will create a file containing this info. A good place to put it might be under “/root”: