[Samba] Samba 3.4.3 and DOS read only

Günter Kukkukk linux at kukkukk.com
Sun Aug 26 10:34:13 MDT 2012


Am Freitag, 24. August 2012, 23:40:42 schrieb Jim Gallagher:
> All,
> 
> Sorry for not following up. Crazy week.
> 
> Anyway, the "username" parameter should have been "valid users". I just
> took it out, since my test share is not browseable. I also upped log level
> to 4. I do not get any log entry at all when trying to set the DOS RO
> attribute, and the unix permissions do not get changed. The log for my test
> session is below.
> 
> Thanks,
> Jim
> 
> 
> 
> 
> [2012/08/24 14:12:09,  3] param/loadparm.c:5982(lp_load_ex)
>   lp_load_ex: refreshing parameters
> Initialising global parameters
> [2012/08/24 14:12:09,  3] ../lib/util/params.c:550(pm_process)
>   params.c:pm_process() - Processing configuration file
> "/etc/opt/samba/sgpkg1/sgpkg1.conf"
> [2012/08/24 14:12:09,  3] param/loadparm.c:4658(do_section)
>   Processing section "[global]"
>   doing parameter lock directory = /var/opt/samba/sgpkg1/locks
>   doing parameter private dir = /var/opt/samba/sgpkg1/private
>   doing parameter pid directory = /var/opt/samba/sgpkg1/locks
>   doing parameter state directory = /var/opt/samba/sgpkg1/locks
>   doing parameter cache directory = /var/opt/samba/sgpkg1/locks
>   doing parameter include = /etc/opt/samba/sgpkg1/sgpkg1.conf.%m
> [2012/08/24 14:12:09,  2] param/loadparm.c:4112(handle_include)
>   Can't find include file /etc/opt/samba/sgpkg1/sgpkg1.conf.clientip
>   doing parameter socket address = serverip
>   doing parameter interfaces = serverip
>   doing parameter bind interfaces only = yes
>   doing parameter max log size = 1000
>   doing parameter username map = /etc/opt/samba/sgpkg1/smbusers.map
>   doing parameter security = domain
>   doing parameter local master = no
>   doing parameter password server = <server list>
>   doing parameter wins server = <server list>
>   doing parameter dns proxy = yes
>   doing parameter encrypt passwords = yes
>   doing parameter smb passwd file = /var/opt/samba/sgpkg1/private/smbpasswd
>   doing parameter preserve case = yes
>   doing parameter short preserve case = yes
>   doing parameter dos filetime resolution = yes
>   doing parameter read only = no
>   doing parameter syslog = 0
>   doing parameter kernel oplocks = no
>   doing parameter oplocks = no
>   doing parameter level2 oplocks = no
>   doing parameter guest account = smbguest
>   doing parameter use mmap = no
>   doing parameter unix extensions = no
> [2012/08/24 14:12:09,  2] param/loadparm.c:4675(do_section)
>   Processing section "[vob_storage]"
>   doing parameter path = /vob_storage
>   doing parameter create mask = 0775
>   doing parameter directory mask = 0775
>   doing parameter oplocks = no
>   doing parameter force group = group1
>   doing parameter map archive = no
>   doing parameter map hidden = no
> [2012/08/24 14:12:09,  2] param/loadparm.c:4675(do_section)
>   Processing section "[view_storage]"
>   doing parameter path = /view_storage
>   doing parameter create mask = 0775
>   doing parameter directory mask = 0775
>   doing parameter oplocks = no
>   doing parameter force group = group1
>   doing parameter map archive = no
>   doing parameter map hidden = no
> [2012/08/24 14:12:09,  2] param/loadparm.c:4675(do_section)
>   Processing section "[build_storage]"
>   doing parameter path = /build_storage
>   doing parameter create mask = 0775
>   doing parameter directory mask = 0775
>   doing parameter oplocks = no
>   doing parameter force group = group1
>   doing parameter map archive = no
>   doing parameter map hidden = no
> [2012/08/24 14:12:09,  2] param/loadparm.c:4675(do_section)
>   Processing section "[developer_views]"
>   doing parameter path = /developer_views
>   doing parameter create mask = 0775
>   doing parameter directory mask = 0775
>   doing parameter oplocks = no
>   doing parameter force group = group1
>   doing parameter map archive = no
>   doing parameter map hidden = no
> [2012/08/24 14:12:09,  2] param/loadparm.c:4675(do_section)
>   Processing section "[proj1data01]"
>   doing parameter path = /proj1data01
>   doing parameter create mask = 0775
>   doing parameter directory mask = 0775
>   doing parameter oplocks = no
>   doing parameter map archive = no
>   doing parameter map hidden = no
> [2012/08/24 14:12:09,  2] param/loadparm.c:4675(do_section)
>   Processing section "[proj1lib]"
>   doing parameter path = /proj1lib
>   doing parameter create mask = 0775
>   doing parameter directory mask = 0775
>   doing parameter oplocks = no
>   doing parameter map archive = no
>   doing parameter map hidden = no
> [2012/08/24 14:12:09,  2] param/loadparm.c:4675(do_section)
>   Processing section "[Test]"
>   doing parameter comment = Setup to test dos RO attribute
>   doing parameter browseable = No
>   doing parameter path = /home/jim
>   doing parameter writeable = yes
>   doing parameter ea support = no
>   doing parameter store dos attributes = no
>   doing parameter map readonly = yes
>   doing parameter dos filemode = yes
> [2012/08/24 14:12:09,  4] param/loadparm.c:6017(lp_load_ex)
>   pm_process() returned Yes
> [2012/08/24 14:12:09,  3] param/loadparm.c:3119(lp_add_ipc)
>   adding IPC service
> [2012/08/24 14:12:09,  3] printing/pcap.c:136(pcap_cache_reload)
>   reloading printcap cache
> [2012/08/24 14:12:09,  3] printing/print_svid.c:66(sysv_cache_reload)
>   Scheduler is not running!!!
> [2012/08/24 14:12:09,  3] printing/pcap.c:243(pcap_cache_reload)
>   reload status: error
> [2012/08/24 14:12:09,  3] printing/pcap.c:136(pcap_cache_reload)
>   reloading printcap cache
> [2012/08/24 14:12:09,  3] printing/print_svid.c:66(sysv_cache_reload)
>   Scheduler is not running!!!
> [2012/08/24 14:12:09,  3] printing/pcap.c:243(pcap_cache_reload)
>   reload status: error
> [2012/08/24 14:12:09,  2] lib/interface.c:338(add_interface)
>   added interface lan0:1 ip=serverip bcast=bcastip netmask=255.255.255.0
> [2012/08/24 14:12:09,  3] smbd/oplock.c:911(init_oplocks)
>   init_oplocks: initializing messages.
> [2012/08/24 14:12:09,  3] smbd/process.c:1473(process_smb)
>   Transaction 0 of length 137 (0 toread)
> [2012/08/24 14:12:09,  3] smbd/process.c:1288(switch_message)
>   switch message SMBnegprot (pid 26350) conn 0x0
> [2012/08/24 14:12:09,  3] smbd/sec_ctx.c:309(set_sec_ctx)
>   setting sec ctx (0, 0) - sec_ctx_stack_ndx = 0
> [2012/08/24 14:12:09,  3] smbd/negprot.c:566(reply_negprot)
>   Requested protocol [PC NETWORK PROGRAM 1.0]
> [2012/08/24 14:12:09,  3] smbd/negprot.c:566(reply_negprot)
>   Requested protocol [LANMAN1.0]
> [2012/08/24 14:12:09,  3] smbd/negprot.c:566(reply_negprot)
>   Requested protocol [Windows for Workgroups 3.1a]
> [2012/08/24 14:12:09,  3] smbd/negprot.c:566(reply_negprot)
>   Requested protocol [LM1.2X002]
> [2012/08/24 14:12:09,  3] smbd/negprot.c:566(reply_negprot)
>   Requested protocol [LANMAN2.1]
> [2012/08/24 14:12:09,  3] smbd/negprot.c:566(reply_negprot)
>   Requested protocol [NT LM 0.12]
> [2012/08/24 14:12:09,  3] smbd/negprot.c:387(reply_nt1)
>   using SPNEGO
> [2012/08/24 14:12:09,  3] smbd/negprot.c:672(reply_negprot)
>   Selected protocol NT LM 0.12
> [2012/08/24 14:12:09,  3] smbd/process.c:1473(process_smb)
>   Transaction 1 of length 142 (0 toread)
> [2012/08/24 14:12:09,  3] smbd/process.c:1288(switch_message)
>   switch message SMBsesssetupX (pid 26350) conn 0x0
> [2012/08/24 14:12:09,  3] smbd/sec_ctx.c:309(set_sec_ctx)
>   setting sec ctx (0, 0) - sec_ctx_stack_ndx = 0
> [2012/08/24 14:12:09,  3] smbd/sesssetup.c:1404(reply_sesssetup_and_X)
>   wct=12 flg2=0xc807
> [2012/08/24 14:12:09,  2] smbd/sesssetup.c:1359(setup_new_vc_session)
>   setup_new_vc_session: New VC == 0, if NT4.x compatible we would close all
> old resources.
> [2012/08/24 14:12:09,  3]
> smbd/sesssetup.c:1160(reply_sesssetup_and_X_spnego)
>   Doing spnego session setup
> [2012/08/24 14:12:09,  3]
> smbd/sesssetup.c:1201(reply_sesssetup_and_X_spnego)
>   NativeOS=[] NativeLanMan=[] PrimaryDomain=[]
> [2012/08/24 14:12:09,  3] smbd/sesssetup.c:785(reply_spnego_negotiate)
>   reply_spnego_negotiate: Got secblob of size 40
> [2012/08/24 14:12:09,  3] libsmb/ntlmssp.c:62(debug_ntlmssp_flags)
>   Got NTLMSSP neg_flags=0xe2088297
>     NTLMSSP_NEGOTIATE_UNICODE
>     NTLMSSP_NEGOTIATE_OEM
>     NTLMSSP_REQUEST_TARGET
>     NTLMSSP_NEGOTIATE_SIGN
>     NTLMSSP_NEGOTIATE_LM_KEY
>     NTLMSSP_NEGOTIATE_NTLM
>     NTLMSSP_NEGOTIATE_ALWAYS_SIGN
>     NTLMSSP_NEGOTIATE_NTLM2
>     NTLMSSP_NEGOTIATE_VERSION
>     NTLMSSP_NEGOTIATE_128
>     NTLMSSP_NEGOTIATE_KEY_EXCH
>     NTLMSSP_NEGOTIATE_56
> [2012/08/24 14:12:09,  3] smbd/process.c:1473(process_smb)
>   Transaction 2 of length 578 (0 toread)
> [2012/08/24 14:12:09,  3] smbd/process.c:1288(switch_message)
>   switch message SMBsesssetupX (pid 26350) conn 0x0
> [2012/08/24 14:12:09,  3] smbd/sec_ctx.c:309(set_sec_ctx)
>   setting sec ctx (0, 0) - sec_ctx_stack_ndx = 0
> [2012/08/24 14:12:09,  3] smbd/sesssetup.c:1404(reply_sesssetup_and_X)
>   wct=12 flg2=0xc807
> [2012/08/24 14:12:09,  2] smbd/sesssetup.c:1359(setup_new_vc_session)
>   setup_new_vc_session: New VC == 0, if NT4.x compatible we would close all
> old resources.
> [2012/08/24 14:12:09,  3]
> smbd/sesssetup.c:1160(reply_sesssetup_and_X_spnego)
>   Doing spnego session setup
> [2012/08/24 14:12:09,  3]
> smbd/sesssetup.c:1201(reply_sesssetup_and_X_spnego)
>   NativeOS=[] NativeLanMan=[] PrimaryDomain=[]
> [2012/08/24 14:12:09,  3] libsmb/ntlmssp.c:744(ntlmssp_server_auth)
>   Got user=[jim] domain=[domain] workstation=[clientname] len1=24 len2=334

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


More information about the samba mailing list