Kodi and SMBv1

I recently disabled SMBv1 on my server after the WannaCry storm. It immediately killed OSMC’s ability to connect to shares through SMB.
Information how to make Kodi work together with SMBv2/3 is hard to find in one place and the posts are sometimes contradicting each other.

It basically comes down to some additions in the .smb/smb.conf file.
You need to add or change to following 3 settings under the global headline.

[global]
client min protocol = SMB2
client max protocol = SMB3
client NTLMv2 auth = yes

You can read the full post here.
full text

Hopes this helps some other folks.

1 Like

Kodi automatically generates the .smb conf to avoid overwriting the global one.

We can patch Kodi to change the file as per your suggestions, but I think client min protocol should be SMB1. Some people may still rely on SMBv1 with older devices.

Can you confirm if it still works with this change?

Thanks for the post and for bringing this to my attention.

Sam

I can confirm that setting the client min protocol = SMB1 doesn’t break connecting with a Samba server running SMB2 and Windows Server 2016.
It did not bring back the browsing functionality.

I agree that for non-enthusiast disabling SMBv1 can be frustrating and the breaking browsing function certainly doesn’t help but at least those who want SMB2 can use this.

Didn’t expect it to unfortunately, but it lets us use SMB2/SMB3 where we can.

Kodi v17 is still focused on Samba 3.x, but the good news is they are moving forward. I believe the WAF based buildsystem has been an obstacle for them. We found this problematic when trying to chase down some regressions in the upstream (Debian) version of Samba.

Can you please share more information about how to make these changes? I can’t locate the .SMB folder.

Under ~/.kodi I only see addons, media, system, temp, userdata. Am I in the wrong place?

What do you use to edit the file once you find it?

I also tried to run sudo smbstatus -b and received the message “Command not found”

Hi,

Its not in th .kodi folder, its in the osmc home folder. (~)

Thanks Tom.

I found the file here: ~/.smb/smb.conf

Hi,

Apologies if I didn’t make myself clear, I was trying to say thats where you would find it.

Anyway you can edit using nano:

nano ~/.smb/smb.conf

make the changes and ctrl-x to exit and yes to save changes.

Thanks Tom.

P.S

I may be wrong, but I believe smbstatus is installed as part of Samba (SMB) Server. Which shouldn’t be required for connecting to smb shares on another device. If your having issues setting up Samba (SMB) Server, you would probably better starting a new topic.

Tom.

Thanks Tom.

Thanks for the help Tom.

I’ve successfully modified the file, but Kodi doesn’t appear to respect it.

With SMB v1 disabled on my server, Kodi cannot access the shares.
If I re-enable SMB v1 on my server, Kodi can access the shares, which it shouldn’t be able to given I have client min protocol = SMB2 set.

Do I need to modify the global smb.conf file also?

Hi,

I’m not familiar with this as I should be, I use NFS for my shares. Any changes made ~/.smb/smb.conf, should be respected without making changes to the global version. Did you restart OSMC after making changes?

Also it may be worth posting ~/.smb/smb.conf, also debugging logs may give us more of an Idea of whats going on.

Thanks Tom.

Yes I restarted OSMC after making changes.

The entire contents of my ~/.smb/smb.conf file:

[global]
preferred master = no
local master = no
domain master = no
client lanman auth = yes
lanman auth = yes
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536
lock directory = /home/osmc/.smb/
client use spnego = no
client ntlmv2 auth = yes
name resolve order = bcast host
client min protocol = SMB2
client max protocol = SMB3_11

All I added was the last 2 lines, and I changed the Auth from No to Yes.

I’m not sure where the debugging logs are but I can share them.

Did this help?
If not – try a debug log.

Will make these changes default in the next update

It’s still not working. How do I get a debug log?

https://osmc.tv/wiki/general/how-to-submit-a-useful-support-request/

I think I did it right.

https://paste.osmc.tv/royozexeku

Well not directly related but you have an issue on your samba packages. you might want to purge all of them and then just reinstall via app-store (if you use the samba server on OSMC at all).

Job for smbd.service failed. See 'systemctl status smbd.service' and 'journalctl -xn' for details.
invoke-rc.d: initscript smbd, action "start" failed.
dpkg: error processing package samba (--configure):
 subprocess installed post-installation script returned error exit status 1
Processing triggers for libc-bin (2.19-18+deb8u10) ...
Processing triggers for systemd (215-17+deb8u7) ...
Errors were encountered while processing:
 samba
Log ended: 2017-07-03  15:09:08

The next strange thing is this error which might point to a wrong client version unless there is a typo I don’t see

Jul 03 20:00:29 pi mediacenter[338]: WARNING: Ignoring invalid value 'SMB3_11' for parameter 'client max protocol'

Lastely this error, Connection timed out might have other reasons so I first would check the server side and also server side log.

20:00:45.586 T:1715225584   ERROR: SMBDirectory->GetDirectory: Unable to open directory : 'smb://USERNAME:PASSWORD@BIGBLACKBOX/Videos/Movies'
                                            unix_err:'6e' error : 'Connection timed out'

I tried to install Samba to get the command to show SMB status. Install failed. I don’t need SMB server though, only client.

This is a giant error: This is probably related to my problem.
Jul 03 20:00:29 pi mediacenter[338]: WARNING: Ignoring invalid value ‘SMB3_11’ for parameter ‘client max protocol’

Server works fine if I enable SMB v1 on it. But once I block it, the timeout is instantaneous.

Hi,

Try changing:

client max protocol = SMB3_11

to

client max protocol = SMB3

Just a guess as its being reported as invalid.

Also may help if you could advise on the device with samba shares on i.e pc, nas or server?

Thanks Tom.

1 Like

Sorry guys for providing a faulty parameter.
SMB3_11 is not a valid option for every samba configuration. SMB3 should be working for most installations. I changed it in the post.

smbstatus is a command run on a samba server. For a Windows server you can do the same with PowerShell. Use:
Get-SmbSession | Select-Object -Property SessionId,ClientComputerName,ClientUserName,NumOpens,Dialect | Format-Table

1 Like

Changing:

client max protocol = SMB3_11

to

client max protocol = SMB3

Fixed it!

I’ve confirmed with the power shell command. Yay! Thanks for the help everybody!