Joined: 26 Mar 2013 Posts: 1856 Location: Hung Hom, Hong Kong
Posted: Tue Jul 13, 2021 5:30 Post subject: Starting wsdd2 and ksmbd using custom configs
OH well, I guess I figured it out!
ksmbd or ksmbd.mountd did NOT bind directly to network intferfaces, but to wsdd2!!!!
I compared /usr/sbin/wsdd2 and /usr/sbin/ksmbd.mountd in both build 46979 and build 47040. Turned out that wsdd2 are the same, but NOT ksmbd.mountd.
So I copied ksmbd.mountd from 46979 to 47033. Then I manually killed ksmbd by process ids without using servicestop, thus keeping wsdd2 running. Then I manually started the copied ksmbd.mountd, Samba problem was *SOLVED*, no connection error from Win 10, no netlink errors in DD-WRT's syslog.
Still, is there a better if not proper also EASY way to use my own smb.conf? _________________ Router: Asus RT-N18U (rev. A1)
Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!
Joined: 26 Mar 2013 Posts: 1856 Location: Hung Hom, Hong Kong
Posted: Thu Jul 22, 2021 6:23 Post subject:
MuzzleVelocity wrote:
mwchang wrote:
So I copied ksmbd.mountd from 46979 to 47033.
how exactly did you do that? Did you use the firmware-extraction tool and then rebuild it?
I just flashed my RT-N18U with DD-WRT build 46979, copy /usr/sbin/ksmbd.mountd to a USB flash drive at /mnt/sda1 (or you could use JFFS but beware that it might be affected by factory reset).
And here is how I run ksmbd.mountd using my own smb.conf
1. SSH into DD-WRT after enabling SSH service
2. execute "service samba3 stop" twice
3. execute "service samba3 start" to start samba3
4. use "ps" to make sure that both ksmbd.mountd and wsdd2 were started
5. execute "killall ksmbd.mountd" twice
6. use "ps" to make sure that ksmbd.mountd was not running, but only wsdd2.
7. cp /tmp/smb.conf /mnt/sda1/my.smb.conf
8. edit /mnt/sda1/my/smb.conf for your needs
9. execute "/usr/sbin/ksmbd.mountd -c /mnt/sda1/my.smb.conf -u /tmp/smb.db" to start samba3 with your smb.conf
_________________ Router: Asus RT-N18U (rev. A1)
Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!
Joined: 26 Mar 2013 Posts: 1856 Location: Hung Hom, Hong Kong
Posted: Thu Jul 22, 2021 6:35 Post subject:
Further testing, involving resetting DD-WRT settings to factory defaults, found that the problem was caused by the "map to guest" global paramater in smb.conf!
SO we don't need to play with executable in different DD-WRT builds, but this trick might trouble-shoot other problems.
I hit Factory Default -> Restore Factory Defaults. Then enabled USB storage and Samba in Services->NAS.
Samba 3 was still denying Win 10 connections. smbclient in Linux had no problem accessing it.
Both Encryption and Users were not relevant.
I noticed that DD-WRT was not using NAS->Samba->User String as computer name, but Setup->Router Name!
In Basic Setup->Optional Settings, no menu item for CTF and FA!
BTW, I forgot to backup \jffs before doing the reset and lost all files there including my unbound.conf!
Update:
I found that if I changed [global] parameter in /tmp/smb.conf "map to guest = never" to "map to guest = bad user", samba3 worked. Even public folders worked without prompting for passwords, and non-public shares asked for passwords as expected.
All other parameters in smb.conf were not relevant.
The default value for "map to guest" is indeed "never", according to the Samba docs I found via Google.
Mr. BrainSlayer, please take note and fix it. When did you set it to "never"? Since which build?
Did programmers of ksmbd.mountd changed the default?
Alternatively, could you add an option in the WEBUI for "map to guest"? Let users decide whether to use "never" or "bad user".
Update 2:
To properly test the share login from Windows, you need to "net use * /delete" then logout and log back in. Otherwise, the credential to DD-WRT's samba3 would be remembered and be used automatically.
You might also need to run "netsh winsock reset" and reboot, but less likely.
I think the following might be the reason for "never":
Joined: 26 Mar 2013 Posts: 1856 Location: Hung Hom, Hong Kong
Posted: Thu Jul 22, 2021 14:03 Post subject:
MuzzleVelocity wrote:
mwchang wrote:
And here is how I run ksmbd.mountd using my own smb.conf
... more ...
[/list]
but you would need to do that after each time your router reboots, right?
Yes, Your Honor! You could use startup script to make it automatic. You just need to sleep for a minutes or two so as to run the script after init complete.
I hope BS could introduce a WEBUI item to do it, just like recursive DNS Unbound.
(
that forum bug again when I "Submit" this message ....
Code:
Ran into problems sending Mail. Response: 503 AUTH command used when not advertised
DEBUG MODE
Line : 126
File : smtp.php
)
_________________ Router: Asus RT-N18U (rev. A1)
Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!
If you set it in tmp/smb.conf that change is not permanent, but you can place your own smb.conf on permanent storage in jffs/etc/smb.conf it will be read then
SO I only need to put smb.conf in /jffs/etc and it would be auto-magically used by "service samba3 start"?
_________________ Router: Asus RT-N18U (rev. A1)
Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!