[Samba] Samba 3.4.3 and DOS read only

Jim Gallagher jim at thegallaghers.biz
Wed Aug 29 11:59:33 MDT 2012


New info:

I finally realized there are two log files for each client, one with the IP
address of the client in the file name and the other with the client's
hostname. I have been looking in the former, when the important info was in
the latter. It appears that for the unix_mode() call, there are extra
characters getting appended to the file name. For example, when I try to
set readonly for a file "test.c", the log entry shows:

[2012/08/29 10:17:29,  3] smbd/dosmode.c:135(unix_mode)
  unix_mode(test.cî³°) returning 0744
[2012/08/29 10:17:29,  3] smbd/error.c:56(error_packet_set)
  error packet at smbd/nttrans.c(541) cmd=162 (SMBntcreateX)
NT_STATUS_OBJECT_NAME_NOT_FOUND

The characters did not paste correctly; they are not ASCII.

The file is indeed "test.c". Other files appear to get the same characters
appended for this operation. Wireshark shows the client sends the name as
"test.c". I can open, edit and save the file without issue.

What about my Windows clients could cause this? Smbclient works fine.

Thanks,
Jim

On Sun, Aug 26, 2012 at 4:24 PM, Günter Kukkukk <linux at kukkukk.com> wrote:

> Am Sonntag, 26. August 2012, 22:46:12 schrieb Jim Gallagher:
> > Günter,
> >
> > I am using the Windows file properties dialog and checking the read only
> > box. I have tested with both Windows 2003 and Windows 7 Enterprise
> clients,
> > with the same results. It seems strange to me that there is no log entry
> on
> > the samba side, but I am not familiar with the log levels.
> >
> > Using wireshark, I definitely see traffic after selecting OK from the
> > dialog when attempting to set RO, but I don't know enough about the
> > protocol to decipher what's going on.
> >
> > Thanks,
> > Jim
> >
> > On Sun, Aug 26, 2012 at 9:34 AM, Günter Kukkukk <linux at kukkukk.com>
> wrote:
> > > Hi Jim,
> > >
> > > in your smbd debug log i don't see any call where the dos
> > > attributes are modified.
> > > From what kind of client are you connecting and which commands
> > > do you use to change the readonly/readwrite dos attribute ?
> > >
> > > As Jeremy already posted, with smblient you can use
> > >
> > >   setmode <filename> +r (or -r)
> > >
> > > Inside a windows MSDOS cmdline window you can use
> > >
> > >   attrib *            (to list the current attributes)
> > >   attrib +r somefile  (to set that file read only)
> > >   attrib -r somefile  (to set that file read/write)
> > >
> > > Also the windows GUI file explorer can be used.
> > >
> > > With samba "log level = 4" here i get the following logged:
> > >
> > > a.) Setting read/write for file "test.fil":
> > > [2012/08/26 17:40:11.977248,  3] smbd/dosmode.c:160(unix_mode)
> > >
> > >   unix_mode(test.fil) returning 0644
> > >
> > > [2012/08/26 17:40:11.977857,  3] smbd/reply.c:1390(reply_setatr)
> > >
> > >   setatr name=test.fil mode=0
> > >
> > > Result on the unix side:
> > >   -rw-r--r-- 1 gk users 10000 Aug 12  2011 test.fil
> > >
> > > --------------
> > >
> > > b.) Setting read only for file "test.fil":
> > > [2012/08/26 17:41:23.200130,  3] smbd/dosmode.c:160(unix_mode)
> > >
> > >   unix_mode(test.fil) returning 0444
> > >
> > > [2012/08/26 17:41:23.201050,  3] smbd/reply.c:1390(reply_setatr)
> > >
> > >   setatr name=test.fil mode=1
> > >
> > > Result on the unix side:
> > >  -r--r--r-- 1 gk users 10000 Aug 12  2011 test.fil
> > >
> > > -------------
> > >
> > > Cheers, Günter
>
> when you change a dos attribute, within wireshark you should see
>   Set Information Request, Path:\yourfile
>   Set Information Response
> packet pairs on the wire.
> The passed "File Attributes" can be also viewed.
>
> Haven't tried windows7 here, whether it uses a different approach.
>
> Can you try on your server itself:
> smbclient //localhost/test -U jim
> ... pw entry
> smb: \> setmode yourfile +r
> smb: \> setmode yourfile -r
>
> Cheers, Günter
>


More information about the samba mailing list