Starting wsdd2 and ksmbd using custom configs

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> General Questions
Goto page 1, 2  Next
Author Message
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 847
Location: Hung Hom, Hong Kong

PostPosted: Tue Jul 13, 2021 5:30    Post subject: Starting wsdd2 and ksmbd using custom configs Reply with quote
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)

May the Force and farces be with you! Live long and proper!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
Sponsor
MuzzleVelocity
DD-WRT User


Joined: 23 Apr 2010
Posts: 101

PostPosted: Wed Jul 21, 2021 21:42    Post subject: Reply with quote
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?
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 847
Location: Hung Hom, Hong Kong

PostPosted: Thu Jul 22, 2021 6:23    Post subject: Reply with quote
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)

May the Force and farces be with you! Live long and proper!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832


Last edited by mwchang on Thu Jul 22, 2021 6:46; edited 1 time in total
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 847
Location: Hung Hom, Hong Kong

PostPosted: Thu Jul 22, 2021 6:26    Post subject: Reply with quote
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)

May the Force and farces be with you! Live long and proper!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832


Last edited by mwchang on Thu Jul 22, 2021 6:48; edited 2 times in total
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 847
Location: Hung Hom, Hong Kong

PostPosted: Thu Jul 22, 2021 6:35    Post subject: Reply with quote
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.

DD-WRT Forum :: View topic - New Build - 07/20/2021 - r47074
https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=329716&start=15

mwchang wrote:
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! Smile

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". Smile

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":

use "map to guest = never" · Issue #41 · bertvv/ansible-role-samba · GitHub
https://github.com/bertvv/ansible-role-samba/issues/41

The credential memory was more a problem of Windows, not Samba.

Other relevant threads I found via Google:

"map to guest" parameter
https://lists.samba.org/archive/samba/1999-October/015158.html

ubuntu - How to make Windows 7 remember credentials for a Samba network drive? - Super User
https://superuser.com/questions/240052/how-to-make-windows-7-remember-credentials-for-a-samba-network-drive/262598

How can I clear the "authentication cache" in Windows 7 to a password protected samba share? - Server Fault
https://serverfault.com/questions/326255/how-can-i-clear-the-authentication-cache-in-windows-7-to-a-password-protected

Windows 10 login information for accessing samba share protected directory located on Ubuntu 18.04 - Ask Ubuntu
https://askubuntu.com/questions/1093290/windows-10-login-information-for-accessing-samba-share-protected-directory-locat

Guest access in SMB2 disabled in Windows 10 | TrueNAS Community
https://www.truenas.com/community/threads/guest-access-in-smb2-disabled-in-windows-10.72097/



_________________
Router: Asus RT-N18U (rev. A1)

May the Force and farces be with you! Live long and proper!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
MuzzleVelocity
DD-WRT User


Joined: 23 Apr 2010
Posts: 101

PostPosted: Thu Jul 22, 2021 13:39    Post subject: Reply with quote
mwchang wrote:
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




but you would need to do that after each time your router reboots, right?
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 847
Location: Hung Hom, Hong Kong

PostPosted: Thu Jul 22, 2021 14:03    Post subject: Reply with quote
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 .... Smile
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)

May the Force and farces be with you! Live long and proper!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
MuzzleVelocity
DD-WRT User


Joined: 23 Apr 2010
Posts: 101

PostPosted: Thu Jul 22, 2021 17:06    Post subject: Reply with quote
you could always run Entware and install/configure samba however you want.
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 8134
Location: Netherlands

PostPosted: Thu Jul 22, 2021 17:17    Post subject: Reply with quote
Build 47087 will have the requested update.

How to use your own smb.conf is outlined in the WireGuard Advanced Setup guide on page 17:
https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324787

_________________
Routers:Netgear R7800, R6400v1, R6400v2, Linksys EA8500, EA6900 (XvortexCFE), E2000 (converted WRT320N), WRT54GS v1.
WireGuard Documents & Guides:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=327397
OpenVPN Documents & Guides: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=327398
IPSET: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=327261
Install guide R6400v2:http://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 847
Location: Hung Hom, Hong Kong

PostPosted: Thu Jul 22, 2021 20:01    Post subject: Reply with quote
egc wrote:
How to use your own smb.conf is outlined in the WireGuard Advanced Setup guide on page 17:
https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324787

Quote:
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)

May the Force and farces be with you! Live long and proper!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 8134
Location: Netherlands

PostPosted: Thu Jul 22, 2021 20:22    Post subject: Reply with quote
That is how it should work yes.

But it can take some time before jffs mounts so that is why a sleep and start / stop is often necessary

_________________
Routers:Netgear R7800, R6400v1, R6400v2, Linksys EA8500, EA6900 (XvortexCFE), E2000 (converted WRT320N), WRT54GS v1.
WireGuard Documents & Guides:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=327397
OpenVPN Documents & Guides: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=327398
IPSET: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=327261
Install guide R6400v2:http://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 847
Location: Hung Hom, Hong Kong

PostPosted: Thu Jul 22, 2021 20:27    Post subject: Reply with quote
egc wrote:
That is how it should work yes.

But it can take some time before jffs mounts so that is why a sleep and start / stop is often necessary

Ok, I got it working! Thanks
Code:
 3859 root     wsdd2 -d -N ROUTER2 -G WORKGROUP -b vendor:dd-wrt,model:Asus RT-N18U,sku:47086
 3862 root     ksmbd.mountd -c /jffs/etc/smb.conf -u /tmp/smb.db
 3863 root     ksmbd.mountd -c /jffs/etc/smb.conf -u /tmp/smb.db

Is this trick applicable to all config files in /etc? I had used it to setup /jffs/etc/unbound.conf!

BTW, should I enable jffs2? I think I forgot how I get /jffs mounted.... Smile


_________________
Router: Asus RT-N18U (rev. A1)

May the Force and farces be with you! Live long and proper!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 8134
Location: Netherlands

PostPosted: Fri Jul 23, 2021 11:32    Post subject: Reply with quote
Do not JFFS2 together with a USB stick where you mount jffs that does not work.

I have a USB stick with two ext2 partitions one named opt and the other jffs, when using automount those two partitions will mount.

Most applications using .conf files from /temp will look first in jffs/etc so that should work (but again as it takes some time to start the USB you usually have to do a restart of the service after the USB stick is mounted)

_________________
Routers:Netgear R7800, R6400v1, R6400v2, Linksys EA8500, EA6900 (XvortexCFE), E2000 (converted WRT320N), WRT54GS v1.
WireGuard Documents & Guides:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=327397
OpenVPN Documents & Guides: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=327398
IPSET: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=327261
Install guide R6400v2:http://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 847
Location: Hung Hom, Hong Kong

PostPosted: Sat Jul 24, 2021 7:58    Post subject: Reply with quote
egc wrote:
Do not JFFS2 together with a USB stick where you mount jffs that does not work.

I have a USB stick with two ext2 partitions one named opt and the other jffs, when using automount those two partitions will mount.


Thanks! It seemed that I was using jffs2 as \jffs\ all the time. I just needed to backup frequently.

Does DD-WRT's backup function include jffs2 partition? My guess is "no".


_________________
Router: Asus RT-N18U (rev. A1)

May the Force and farces be with you! Live long and proper!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 8134
Location: Netherlands

PostPosted: Sat Jul 24, 2021 8:03    Post subject: Reply with quote
No it does not backup your jffs2 partition.

I am always hesitant to use jffs2 as there is the possibility to wear out your flash ram and I once bricked a router when upgrading with jffs2 enabled but that could just be me Sad

_________________
Routers:Netgear R7800, R6400v1, R6400v2, Linksys EA8500, EA6900 (XvortexCFE), E2000 (converted WRT320N), WRT54GS v1.
WireGuard Documents & Guides:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=327397
OpenVPN Documents & Guides: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=327398
IPSET: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=327261
Install guide R6400v2:http://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
Goto page 1, 2  Next Display posts from previous:    Page 1 of 2
Post new topic   Reply to topic    DD-WRT Forum Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum