Posts Tagged ‘technology’

mount.cifs and permissions problems under ubuntu linux

Posted in linux, Miscellaneous on December 2nd, 2008 by Richard Walker – 1 Comment

Recently, I’ve had an issue using mount.cifs from the command line in linux to mount shares, on Ubuntu Linux (as a client).

The problem was, mounting a samba share using CIFS and using only the samba username/password would render the entire mount unwriteable, except by root.

The dead simple solution to this is as follows.

Instead of doing just this:

mount.cifs //<server>/<share> -ouser=<username>,pass=<password>

Try this:

mount.cifs //<server>/<share> -ouid=<localuser>,gid=<localgroup>,user=<username>,pass=<password>

So if your samba username is joe.bloggs, and your username and group on your local machine are just “joe”, you’d do this:

mount.cifs //<server>/<share> -ouid=joe,gid=joe,user=joe.bloggs,pass=<password>

This simply tells CIFS that user ‘joe’ on the local machine should be the owner of the mounted share, and then subject to whatever permissions the samba server has set.

Easy as!