mount.cifs and permissions problems under ubuntu linux

Miscellaneous, linux

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!

Tags: , , , ,

One Comment

  1. wulfman says:

    This is great info. Interestingly this is not needed on RHEL5.5/CentOS5.5.

Leave a Comment

Please note: Only comment if you intend on contributing to discussion. Comments with outbound links that just amount to "Wow, great post, keep up the good work" will be regarded as spam and DELETED.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Red HD Camera Rental - Amazon Wish List Tracker