Samba and read-only attribute

Paul Heinz paul at
Fri Oct 8 00:57:50 GMT 1999

Danny wrote:
> On Fri, 8 Oct 1999, Paul Heinz wrote:
> > Danny wrote:
> > > The problem lies in the fact that with the old system any
> user who had rw
> > > access to the directory and the files in it could also set the RO
> > > attribute.  With FreeBSD (and most (all?) unices), only the owner can
> > > change the permissions on a file.
> >
> > Add a user to be the share owner. Ensure that all the files
> within a given
> > share have the nominated owner via a quick chown as root. For
> that share,
> > add a 'force user = <share owner>' to your smb.conf and the problem is
> > solved - anyone who can access said share can now change file
> attributes.
> Thanks Paul.  Unfortunately the problem has to be solved at the directory
> level not the share level.

Ah, in that case, you'll need to essentially step outside POSIX semantics
and become root to allow the attributes change.

I'm fairly new to the Samba source but have a look at dosmode.c:file_utime()
lines 212-234 (in Samba 2.05a) where there is a similar solution to setting
the timestamp on files for non-owners.

I think it should be possible to patch dosmode.c:file_chmod() above to have
a similar become_root()/unbecome_root() wrapper across a call to dos_chmod()
for non-owned files which have appropriate 'extenuating circumstances'.

For performance reasons, I imagine you'd only want to resort to this when a
normal 'unagumented' call to dos_chmod() fails, just like file_utime() does.


More information about the samba-technical mailing list