[Samba] Re: chown failure on a samba share

Shirish Pargaonkar shirishpargaonkar at gmail.com
Wed Mar 11 10:11:18 GMT 2009


On Wed, Mar 11, 2009 at 2:43 AM, Volker Lendecke
<Volker.Lendecke at sernet.de> wrote:
> On Tue, Mar 10, 2009 at 09:41:58PM -0500, Shirish Pargaonkar wrote:
>> On Tue, Mar 10, 2009 at 9:32 PM, Shirish Pargaonkar
>> <shirishpargaonkar at gmail.com> wrote:
>> > Is this working as designed or a samba bug?
>> >
>> > I am trying to chown ownership of a file in a samba share and it
>> > results in an error.
>> >
>> > cifstest6:~ # smbclient //cifstest8/smb8 -U root
>> > Enter root's password:
>> > Domain=[CIFSTEST8] OS=[Unix] Server=[Samba 3.4.0-GIT-e6a5f11-devel]
>> > smb: \> chown 65534 65534 file2
>> > NT_STATUS_ACCESS_DENIED chown file \file2 uid=65534, gid=65534
>> >
>> > The share is thus exported
>> >
>> > [smb88]
>> >        path =  /tmp/cifstest88
>> >        browseable = Yes
>> >        read only = No
>> >        guest ok = Yes
>> >        writable = yes
>> >        printable = yes
>> >
>> > ls -l /tmp/cifstest8/file2
>> > -rwxrwxrwx 1 root root 0 Mar 10 10:47 /tmp/cifstest8/file2
>> >
>> >
>> > [2009/03/10 11:40:24,  3] smbd/trans2.c:6831(call_trans2setfilepathinfo)
>> >  call_trans2setfilepathinfo(6) file2 (fnum -1) info_level=512 totdata=100
>> > [2009/03/10 11:40:24, 10] smbd/trans2.c:6069(smb_set_file_unix_basic)
>> >  smb_set_file_unix_basic: SMB_SET_FILE_UNIX_BASIC: name = file2 size
>> > = 0, uid = 65534, gid = 65533, raw perms = 037777777777
>> > [2009/03/10 11:40:24, 10] smbd/trans2.c:6129(smb_set_file_unix_basic)
>> >  smb_set_file_unix_basic: SMB_SET_FILE_UNIX_BASIC changing owner
>> > 65534 for path file2
>> > [2009/03/10 11:40:24,  3] smbd/error.c:60(error_packet_set)
>> >  error packet at smbd/trans2.c(7087) cmd=50 (SMBtrans2) NT_STATUS_ACCESS_DENIED
>
> Just tried with current master: Works fine for me. Can you
> post an strace of smbd trying to do this?
>
> Volker
>

Volker,

Thanks.  Here is the info.

This is how I started collecting strace info

strace -f /etc/init.d/smb start

#SMBD_BIN="/usr/sbin/smbd"
SMBD_BIN="/usr/local/samba/sbin/smbd"
SMB_CONF="/etc/samba/smb.conf"
PID_FILE="/var/run/samba/smbd.pid"


# /usr/local/samba/sbin/smbd -V
Version 3.4.0-GIT-e6a5f11-devel


 ps -eaf | grep smb
root      8604     1  0 04:41 ?        00:00:00
/usr/local/samba/sbin/smbd -D -s /etc/samba/smb.conf
root      8605  8604  0 04:41 ?        00:00:00
/usr/local/samba/sbin/smbd -D -s /etc/samba/smb.conf
root      8609  8604  0 04:41 ?        00:00:00
/usr/local/samba/sbin/smbd -D -s /etc/samba/smb.conf
root      8658  8604  0 04:46 ?        00:00:00
/usr/local/samba/sbin/smbd -D -s /etc/samba/smb.conf


smbclient //cifstest8/smb8 -U root
Enter root's password:
Domain=[CIFSTEST8] OS=[Unix] Server=[Samba 3.4.0-GIT-e6a5f11-devel]
smb: \> chown 65534 65534 file2
NT_STATUS_ACCESS_DENIED chown file \file2 uid=65534, gid=65534


                                                .....................
                                                .....................
[pid  8730] write(21, "  change_to_user uid=(0,65534) g"..., 45) = 45
[pid  8730] stat("/etc/localtime", {st_mode=S_IFREG|0644,
st_size=3543, ...}) = 0
[pid  8730] geteuid()                   = 65534
[pid  8730] write(21, "[2009/03/11 04:53:12,  4] smbd/v"..., 52) = 52
[pid  8730] geteuid()                   = 65534
[pid  8730] write(21, "  vfs_ChDir to /tmp/cifstest8\n", 30) = 30
[pid  8730] chdir("/tmp/cifstest8")     = 0
[pid  8730] stat("/etc/localtime", {st_mode=S_IFREG|0644,
st_size=3543, ...}) = 0
[pid  8730] geteuid()                   = 65534
[pid  8730] write(21, "[2009/03/11 04:53:12,  5] smbd/f"..., 60) = 60
[pid  8730] geteuid()                   = 65534
[pid  8730] write(21, "  unix_convert called on file \"f"..., 38) = 38
[pid  8730] stat("/etc/localtime", {st_mode=S_IFREG|0644,
st_size=3543, ...}) = 0
[pid  8730] geteuid()                   = 65534
[pid  8730] write(21, "[2009/03/11 04:53:12, 10] smbd/s"..., 66) = 66
[pid  8730] geteuid()                   = 65534
[pid  8730] write(21, "  stat_cache_lookup: lookup fail"..., 52) = 52
[pid  8730] stat("file2", {st_mode=S_IFREG|0777, st_size=0, ...}) = 0
[pid  8730] stat("/etc/localtime", {st_mode=S_IFREG|0644,
st_size=3543, ...}) = 0
[pid  8730] geteuid()                   = 65534
[pid  8730] write(21, "[2009/03/11 04:53:12,  5] smbd/s"..., 63) = 63
[pid  8730] geteuid()                   = 65534
[pid  8730] write(21, "  stat_cache_add: Added entry (7"..., 67) = 67
[pid  8730] stat("/etc/localtime", {st_mode=S_IFREG|0644,
st_size=3543, ...}) = 0
[pid  8730] geteuid()                   = 65534
[pid  8730] write(21, "[2009/03/11 04:53:12,  5] smbd/f"..., 60) = 60
[pid  8730] geteuid()                   = 65534
[pid  8730] write(21, "  conversion finished file2 -> f"..., 37) = 37
[pid  8730] lstat("file2", {st_mode=S_IFREG|0777, st_size=0, ...}) = 0
[pid  8730] stat("/etc/localtime", {st_mode=S_IFREG|0644,
st_size=3543, ...}) = 0
[pid  8730] geteuid()                   = 65534
[pid  8730] write(21, "[2009/03/11 04:53:12,  3] smbd/t"..., 73) = 73
[pid  8730] geteuid()                   = 65534
[pid  8730] write(21, "  call_trans2setfilepathinfo(6) "..., 75) = 75
[pid  8730] stat("/etc/localtime", {st_mode=S_IFREG|0644,
st_size=3543, ...}) = 0
[pid  8730] geteuid()                   = 65534
[pid  8730] write(21, "[2009/03/11 04:53:12, 10] smbd/t"..., 70) = 70
[pid  8730] geteuid()                   = 65534
[pid  8730] write(21, "  smb_set_file_unix_basic: SMB_S"..., 126) = 126
[pid  8730] stat("/etc/localtime", {st_mode=S_IFREG|0644,
st_size=3543, ...}) = 0
[pid  8730] geteuid()                   = 65534
[pid  8730] write(21, "[2009/03/11 04:53:12, 10] smbd/t"..., 70) = 70
[pid  8730] geteuid()                   = 65534
[pid  8730] write(21, "  smb_set_file_unix_basic: SMB_S"..., 87) = 87
[pid  8730] chown("file2", 65534, 4294967295) = -1 EPERM (Operation
not permitted)
[pid  8730] stat("/etc/localtime", {st_mode=S_IFREG|0644,
st_size=3543, ...}) = 0
[pid  8730] geteuid()                   = 65534
[pid  8730] write(21, "[2009/03/11 04:53:12,  3] smbd/e"..., 60) = 60
[pid  8730] geteuid()                   = 65534
[pid  8730] write(21, "  error packet at smbd/trans2.c("..., 81) = 81
[pid  8730] stat("/etc/localtime", {st_mode=S_IFREG|0644,
st_size=3543, ...}) = 0
[pid  8730] geteuid()                   = 65534
[pid  8730] write(21, "[2009/03/11 04:53:12,  5] lib/ut"..., 51) = 51
[pid  8730] stat("/etc/localtime", {st_mode=S_IFREG|0644,
st_size=3543, ...}) = 0
[pid  8730] geteuid()                   = 65534
[pid  8730] write(21, "[2009/03/11 04:53:12,  5] lib/ut"..., 51) = 51
[pid  8730] geteuid()                   = 65534



I tried this as well

smb: \> chown 65534 file2
chown uid gid file

smb: \> chown 65534 65533 file2
NT_STATUS_ACCESS_DENIED chown file \file2 uid=65534, gid=65533

With just uid supplied to chown command, I do not get any error but
nothing changes on the server.

cifstest8:/tmp/cifstest8 # cat /etc/passwd | grep nobody
nobody:x:65534:65533:nobody:/var/lib/nobody:/bin/bash

cifstest8:/tmp/cifstest8 # cat /etc/group | grep nobody
nobody:x:65533:
nogroup:x:65534:nobody


More information about the samba mailing list