Ksmbd - how to mount in Ubuntu

My router is a TP-Link C7 v5 running on an OpenWrt release 19.07.8 custom image.

How does one mount in Ubuntu a ksmbd-shared directory of the router?

I have already succeeded in doing these 3 things:

  • Use ksmbd to share the router's /mnt/usb, as per link below. Router's /mnt/usb is the mount point for a USB storage medium.

Set up ksmbd for read and write access as named user

  • From a Windows machine, log into router's /mnt/usb as named user (not guest) with write privileges.

  • From Ubuntu, log into a Windows machine's shared folder as named user with write privileges.

Having done that, I thought I could simply model myself on the last bullet and mount router's /mnt/usb from Ubuntu, with something like:

sudo mount -t cifs -o username=bobby,uid=1000,gid=1000 //192.168.1.1/mnt/usb /mnt/router_usb

where "bobby" is both a Linux user and ksmbd user in the router as well as a Linux user in Ubuntu (though I think this last bit does not matter). "bobby" uid is 1000 at both router and Ubuntu.

But the command failed. The error message is "mount error(2): No such file or directory", or in more detail:

bobby@ub18-em:~$ sudo mount -t cifs -o username=bobby,uid=1000,gid=1000 //192.168.1.1/mnt/usb /mnt/router_usb
[sudo] password for bobby:
Password for bobby@//192.168.1.1/mnt/usb:  ******
mount error(2): No such file or directory
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
bobby@ub18-em:~$ 

I've done some Web searches, but apparently this area of mount -t cifs is fraught with technicalities.

I thought it might be faster to ask here. Thanks.

Using 'Reply' as editing seems to have expired.

If not ksmbd, smb mounting commands might also help. (Mounting in Ubuntu an smb share in OpenWrt.) Thanks.

I prefer this way:

nautilus smb://user@host/share

Ctrl+D

1 Like

Thanks! Totally worked for an smb share (e.g. a Windows folder), including the Ctrl+D bookmarking. Mount was good not just for Nautilus but showed in Thunar too.

Doesn't seem to mount a ksmbd share though. ("Oops! Something went wrong. Unhandled error message: Failed to mount Windows share: Invalid argument".) Failed while the OpenWrt ksmbd share location was up in a Windows machine; so I know the location was available.

Try lowering the client side requirements:

sudo sed -i -e "/^\s*client min protocol =/d
/^\[global\]$/a \\\tclient min protocol = NT1" /etc/samba/smb.conf

Thanks. I believe the command edits /etc/samba/smb.conf. What would the lines look like if I were to open the conf file and hand-insert them?

I did try running the command. I thought it was meant to be one line. I tried both of these (the difference being a space after =/d or not):

sudo sed -i -e "/^\s*client min protocol =/d /^\[global\]$/a \\\tclient min protocol = NT1" /etc/samba/smb.conf
sudo sed -i -e "/^\s*client min protocol =/d/^\[global\]$/a \\\tclient min protocol = NT1" /etc/samba/smb.conf

But either gave me:

sed: -e expression #1, char 29: extra characters after command

I ran command on a copy of smb.conf (to preserve the original till I knew what I was about).

Not really, as not every command needs to be a one-liner.
Well, a one-liner is also possible with a semicolon delimiter.

[global]
	client min protocol = NT1
	...

That didn't do either. (I opened smb.conf, inserted the above line with a leading tab just under [global], saved, rebooted the Ubunbu, and tried the nautilus command just the same format that got me to a Windows share folder, all this while the OpenWrt share directory was up and showing in a Windows machine.)

Thanks so much. I would have like to get this ksmbd to work in every way, but can live with not having access to it from Linux.

1 Like

Personally, I use SFTP across my Linux hosts:
https://openwrt.org/docs/guide-user/services/nas/sftp.server
This helps avoid all SMB-related problems.

1 Like

And not NFS?

I have not yet done extensive Linux-Linux networking and am exploring options. Actually I am only just entering the whole Linux world (started when I noticed Microsoft used my old Windows computer so much that I sometimes had to wait). This crash course in OpenWrt has been a real pleasure thanks to help from people like yourself.

I prefer using encrypted connections whenever possible.
This adds another layer of security even if the network is considered private.
Simple configuration, low overhead, no increase in attack surface.

1 Like