Taking ownership of files on NT/2k

Andrew Furey andrew at terminus.net.au
Tue Jan 14 08:38:00 GMT 2003

Hi all,

(I posted this to the samba@ list last week, but I haven't had any 
replies, and since it's somewhat technical, and also somewhat urgent, 
I'm reposting here.)

I have a 2.2.7a member server (on Debian unstable), acting as a file 
server for a W2k domain (which also has some NT4 clients, ie. mixed 
mode). I'm also using ACLs.

Imagine I have a file on the server with an ownership of DOMAIN+foo 
(full permission - rwx). I also have a user ACL on that file of 
DOMAIN+bar, also rwx. This all works fine.

I was initially running into a problem whereby DOMAIN+bar could not 
"take ownership" of the file ("Access denied"). However, I found the 
"dos filemode" option in smb.conf, and that is now working as expected.

Problem is, if I have the same scenario for a directory, it doesn't work 
(also Access denied). I managed to grab some debug=10 logs, and here's 
the relevant snippet:

--- LOG BEGINS ---

[2003/01/09 12:24:52, 10] smbd/posix_acls.c:set_nt_acl(2177)
   set_nt_acl: called for file Corp Services/mytestdir
[2003/01/09 12:24:52, 5] smbd/posix_acls.c:unpack_nt_owners(433)
   unpack_nt_owners: validating owner_sids.
[2003/01/09 12:24:52, 10] nsswitch/wb_client.c:winbind_lookup_sid(111)
   winbind_lookup_sid: SUCCESS: SID 
S-1-5-21-1881940921-547036892-925700815-500 -> BEDROCK Administrator
[2003/01/09 12:24:52, 10] smbd/uid.c:sid_to_uid(657)
   sid_to_uid: winbindd S-1-5-21-1881940921-547036892-925700815-500 -> 10012
[2003/01/09 12:24:52, 5] smbd/posix_acls.c:unpack_nt_owners(474)
   unpack_nt_owners: owner_sids validated.
[2003/01/09 12:24:52, 3] smbd/posix_acls.c:set_nt_acl(2215)
   set_nt_acl: chown Corp Services/mytestdir. uid = 10012, gid = 4294967295.
[2003/01/09 12:24:52, 5] smbd/files.c:file_new(123)
   allocated file structure 3324, fnum = 7420 (3 used)
[2003/01/09 12:24:52, 10] smbd/open.c:fd_open(53)
   fd_open: name Corp Services/mytestdir, flags = 01 mode = 00, fd = -1. 
Is a directory
[2003/01/09 12:24:52, 3] smbd/open.c:open_file(175)
   Error opening file Corp Services/mytestdir (Is a directory) 
(local_flags=1) (flags=1)
[2003/01/09 12:24:52, 5] smbd/files.c:file_free(346)
   freed files structure 7420 (2 used)
[2003/01/09 12:24:52, 3] smbd/posix_acls.c:set_nt_acl(2219)
   set_nt_acl: chown Corp Services/mytestdir, 10012, 4294967295 failed. 
Error = Is a directory.
[2003/01/09 12:24:52, 3] smbd/error.c:error_packet(94)
   error string = Is a directory
[2003/01/09 12:24:52, 3] smbd/error.c:error_packet(113)
   error packet at smbd/nttrans.c(1786) cmd=160 (SMBnttrans) 

--- LOG ENDS ---

As you can see, it seems to be trying to open it (with fd_open), but 
when it sees that it's a directory instead of a file, it simply bombs 
out rather than proceeding. The man page entry for "dos filemode" is 
fairly clear that it _should_ work for directories too.

Any ideas? Is this a bug in Samba?


ANDREW FUREY <andrew at terminus.net.au> - Sysadmin/developer for Terminus.
Providing online networks of Australian lawyers (http://www.ilaw.com.au)
and Linux experts (http://www.linuxconsultants.com.au) for instant help!
Disclaimer: http://www.terminus.net.au/disclaimer.html. GCS L+++ P++ t++

More information about the samba-technical mailing list