KSMBD and OpenWRT

Wiki.TerraBase.info
Jump to navigation Jump to search

Need Windows File Sharing on a low powered router? Samba not cutting it? Wanna really work for it? Try KSMBD!

NOT a CHANCE in HE "double hockey sticks"!

It is hopelessly broken or freaky / funky for OpenWRT in several ways;

  • Share the / (root) directory? Nope, busted. Supposedly fixed that issue in version 3.4.x (or close), but not for OpenWRT's 3.5.3 (as of 12.2024), still busted
  • Windows 11? Ha! Oh, wait, if one enables Guest Access, then it work (sure, right)
  • service ksmbd restart might break it and require a restart, so use stop and start (not fully tested, shouldn't need this level of examination, but sadly it does)
  • Oh, and it is best to explicitly define which Adapters / Interfaces to 'listen' on, instead of allowing the LuCI GUI setting of "undefined"
  • ...after disconnecting device from network, and;
    • ...using the same Windows Explorer session to reconnect, FORGET IT! Close Windows, err, File Explorer, re-open File Explorer and it works!

Would recommend Samba 3, but that's gone, so dog slow Samba 4.

Oh, and there's some weird thing that if there isn't a system user name that's the same as the SMB User Name (added with smbpasswd if one listens to ChatGPT's BS, see below exchange), then KSMBD defaults to 'only guest mode works'. (Funky, huh?)

But if there's nothing else, then dang, just use it, but... (see above)

What is the command to create a user name and password for ksmbd?

ChatGPT said:
ChatGPT
To create a username and password for ksmbd (the Samba server implementation for OpenWRT), you'll need to create a user on the system and then set a password for Samba's use.

Here's how you can do it:

1. Create a system user:
Use the useradd command to create a user account on the system.

sh
Copy code
useradd -m username
This creates a user with the specified username. The -m option ensures that the user's home directory is created.

2. Set a password for the user:
Next, set a password for the user using the passwd command:

sh
Copy code
passwd username
This will prompt you to enter the password for the username account.

3. Create a Samba user for ksmbd:
After creating the user and setting a password, you need to add the user to ksmbd's password database.

To do this, you can use the smbpasswd command (Samba's password management tool). This command will add the user to the Samba user database so they can authenticate with ksmbd.

sh
Copy code
smbpasswd -a username
This will prompt you to enter a password for the Samba user (which can be the same as the system password).

4. Restart ksmbd:
Once you've added the user, you should restart ksmbd to apply the changes.

sh
Copy code
/etc/init.d/ksmbd restart
Summary:
Create a system user: useradd -m username
Set the password: passwd username
Add the user to Samba: smbpasswd -a username
Restart ksmbd: /etc/init.d/ksmbd restart
Let me know if you need more help with this!






You said:
Hmmm.  I did say KSMBD, right?   I noticed that there was no mention of ksmbd.adduser in your response.  Did I miss something?
ChatGPT said:
ChatGPT
You're absolutely right! I missed mentioning the ksmbd.adduser command in my previous response. I apologize for the oversight.

In ksmbd (which is a lightweight Samba server implementation for OpenWRT), you don't use smbpasswd to add users, as you would with the traditional Samba server. Instead, you use the ksmbd.adduser command to create users for the ksmbd service.

Here’s the correct process for adding a user to ksmbd:
1. Create a user for ksmbd:
To create a user for ksmbd, use the ksmbd.adduser command:

sh
Copy code
ksmbd.adduser username
This will add a user for ksmbd, and it will also prompt you to set a password for the user.

2. Restart ksmbd:
After adding the user, restart ksmbd to apply the changes:

sh
Copy code
/etc/init.d/ksmbd restart
Key Differences:
ksmbd.adduser is specifically used for adding users to ksmbd.
smbpasswd is used for traditional Samba setups, not for ksmbd.
Summary of the Correct Commands:
Create a user for ksmbd: ksmbd.adduser username
Restart ksmbd: /etc/init.d/ksmbd restart
Let me know if you need further clarification!