[Samba] mount.cifs Is it possible to have a file owned by the user who creates the file?

steve steve at steve-ss.com
Thu May 17 06:37:00 MDT 2012


On 05/17/2012 02:34 AM, Jeff Layton wrote:
> On Wed, 16 May 2012 17:30:23 +0200
> steve<steve at steve-ss.com>  wrote:
>
>> On 05/16/2012 02:56 PM, steve wrote:
>>> Hi
>>> e.g.
>>> mount.cifs //192.168.1.6/reports /mnt -o rw,setuids,nodev,user=steve2
>>>
>>> Any file created in the share is always owned by steve2 (or the person
>>> who mounted the share).
>>>
>>> According to man cifs(8), the setuids overrides this but doesn't seem
>>> to work for us. We'd like it to be the same behavior as nfs if that's
>>> possible.
>>>
>>> Version 4.0.0alpha21-GIT-46a41d0 with s3fs
>>>
>>> Cheers,
>>> Steve
>>>
>>>
>> CORRECTION:
>> It _looks_ as though it's owned by the person specified as user _when in
>> the share_ but the actual file (the unmounted file) is always owned by root.
>> Steve
> Sadly, permissions enforcement and handling in cifs.ko are badly
> broken by default.
>
> The only way to do this properly is to switch to using multiuser
> mounts. Have a look at the multiuser option in mount.cifs(8) and
> cifscreds(1).
>
> Cheers,
Hi Jeff
Thanks for the confirmation. Strangely, I found by accident that using 
the .gvfs smb:// mount in Nautilus does actually create user owned 
files. I'm sure that there must be a catch there somewhere though:

kinit Administrator
mount.cifs -o rw,uid=3000008,sec=krb5 //server/share /somewhere

produces uid 3000008 files no matter who accesses the share. Leaving off 
the uid= creates files as uid=root. Maybe the .gvfs is doing what you 
described on a who-ever-is-logged-in-and-access's-it basis?

Cheers,
Steve



More information about the samba mailing list