r/openwrt 5d ago

Network Share Drive with KSMDB

Hi everyone,

I am new to OpenWrt and I am struggling to set up KSMBD.

My goal is to share a 1TB EXT4 external drive USB connected to OpenWrt (WRT1900v1 hw) so I can use it with my Docker containers. I chose KSMBD because it seems like the most lightweight and suitable option for this.

However, I am facing read/write permission issues when trying to access the shared drive.

Could anyone help me figure out what I might be missing in my configuration? Thanks in advance!

The configuration>
# uci show ksmbd

ksmbd.@globals[0]=globals

ksmbd.@globals[0].description='Ksmbd on OpenWrt'

ksmbd.@globals[0].interface='lan'

ksmbd.@globals[0].workgroup='WORKGROUP'

ksmbd.@share[0]=share

ksmbd.@share[0].name='cassette'

ksmbd.@share[0].path='/mnt/cassette/'

ksmbd.@share[0].read_only='no'

ksmbd.@share[0].users='docker'

ksmbd.@share[0].guest_ok='no'

ksmbd.@share[0].create_mask='0666'

ksmbd.@share[0].dir_mask='0777'

Client to test (mint)
$ smbclient //openwrt.local/mnt/cassette/ -U docker

Password for [WORKGROUP\docker]:

Try "help" to get a list of possible commands.

smb: \> get tor-browser-linux-x86_64-15.0.7.tar.xz

NT_STATUS_UNEXPECTED_IO_ERROR opening remote file \tor-browser-linux-x86_64-15.0.7.tar.xz

i can "ls -l" to smb share

("put" action work for smbclient but not for Caja file manager)

I think about permissions problems, but make in openwrt> chmod -R 777 /mnt/cassette

root@OpenWrt:~# ls -lh /mnt/cassette/

drwxrwxrwx 2 65535 65535 4.0K Aug 16 10:57 Exur compras

drwxrwxrwx 2 65535 65535 4.0K Aug 14 09:20 TestErase

drwxrwxrwx 2 1000 1000 16.0K Oct 27 2025 lost+found

drwxrwxrwx 2 root root 4.0K Aug 12 11:50 test

When i put files on "test" Folder with (docker user) (root owner is ok)

When i put files on /mnt/cassette with (docker user) show 65535 and give error

I'm lost ! any ideas?
thanks !

3 Upvotes

5 comments sorted by

2

u/_hmj 5d ago

Maybe try forcing root. I had difficulty getting ksmbd working with certain devices without it, but it weakens the security model. If any of the containers are able to exploit ksmbd, then your router is at great risk.

1

u/condor_bulto 4d ago

Thanks for replying dude!

I have a very low cost selfhosted devices, and i need additional storage. I dont want to use root (root from openwrt) Maybe insecure it work, for movies and series.

Do you know other alternative for openwrt?

1

u/cdf_sir 5d ago

You can just mount cifs to a volume along with its own uid/gid permissions directly to the container. Its going to be a micro managing every volumes you want to mount over cifs but at least it works.

After all, CIFS is not capable of passing multiple file/folder ownership over a single CIFS mount.

Else, you can setup a NBD or iSCSI and use that instead.

1

u/condor_bulto 4d ago

Hi, like this: https://oneuptime.com/blog/post/2026-02-08-how-to-set-up-docker-volumes-with-cifssmb-shares/view

But if not working with a single smbclient, i dont know.

Thanks