[SOLVED] No SAMBA connection for OH 2.3.0

Hi,
I can’t establish a samba connection after installing OH 2.3.0 (stable) on an rpi3 running raspbian stretch.

I exactly followed all the steps from https://www.openhab.org/docs/installation/linux.html#package-repository-installation and then https://www.openhab.org/docs/installation/linux.html#recommended-additional-setup-steps
I set samba user to openhab as described with password “openhab” and restarted samba service

sudo systemctl restart smbd.service

Whatever I tried I cannot establish a samba connection from my Win10 machine. User should be openhab with password openhab and folder “\openhabianpi2\openHAB2-conf”. Using my ip instead of the hostname also does not work. I always get wrong username or password.

openhab-cli info shows:

openhab-cli info

Version:     2.3.0 (Build)

User:        openhab (Active Process 394)
User Groups: openhab tty dialout audio

Directories: Folder Name      | Path                        | User:Group
             -----------      | ----                        | ----------
             OPENHAB_HOME     | /usr/share/openhab2         | openhab:openhab
             OPENHAB_RUNTIME  | /usr/share/openhab2/runtime | openhab:openhab
             OPENHAB_USERDATA | /var/lib/openhab2           | openhab:openhab
             OPENHAB_CONF     | /etc/openhab2               | openhab:openhab
             OPENHAB_LOGDIR   | /var/log/openhab2           | openhab:openhab

URLs:        http://192.168.xxx.yyy:8080
             https://192.168.xxx.yyy:8443

What’s the output of

systemctl status smbd.service

?
The Path to the shares would be \\your.ip.goes.here\ (double backslash at beginning).
openhabianpi is only correct if using openHABian to setup openHAB2 (which is the recommended option for Raspberry).
If using openHABian, there is no need to configure samba, as it’s already configured by openHABian.

1 Like

The missing second backslash is simply a copy and paste error.

„openhabianpi2“ is the name I set for my pi. This shouldn’t be a problem.

This is the output of samba service

● smbd.service - Samba SMB Daemon
   Loaded: loaded (/lib/systemd/system/smbd.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2018-07-01 18:12:09 CEST; 3h 21min ago
     Docs: man:smbd(8)
           man:samba(7)
           man:smb.conf(5)
 Main PID: 2254 (smbd)
   Status: "smbd: ready to serve connections..."
   CGroup: /system.slice/smbd.service
           ├─2254 /usr/sbin/smbd
           ├─2255 /usr/sbin/smbd
           ├─2256 /usr/sbin/smbd
           └─2258 /usr/sbin/smbd

Jul 01 18:12:09 openhabianpi2 systemd[1]: Starting Samba SMB Daemon...
Jul 01 18:12:09 openhabianpi2 systemd[1]: smbd.service: Supervising process 2254 which is not our child. We'll most likely not notice when it exits.
Jul 01 18:12:09 openhabianpi2 systemd[1]: Started Samba SMB Daemon.
Jul 01 18:17:35 openhabianpi2 smbd[2351]: pam_unix(samba:session): session closed for user nobody
Jul 01 18:18:08 openhabianpi2 smbd[2364]: pam_unix(samba:session): session closed for user nobody
Jul 01 18:20:27 openhabianpi2 smbd[2386]: pam_unix(samba:session): session closed for user nobody
Jul 01 18:52:36 openhabianpi2 smbd[2703]: pam_unix(samba:session): session closed for user nobody

:slight_smile:

Just wanted to be sure about this :wink:
Looks like you tried to login as user nobody?
Please try

sudo journalctl -fu smbd

This will start journalctl in tail mode, but only give you information about smbd.
Now try to connect to the samba share from your desktop. The output should be like this:

Jul 01 17:41:34 openhab2 smbd[7823]: pam_unix(samba:session): session opened for user openhab by (uid=0)
Jul 02 00:39:43 openhab2 smbd[7823]: pam_unix(samba:session): session closed for user openhab

Hi,

By default, Any windows device will pass local windows username/password to a SMB service to authenticate you. I find that the easy way of connecting to SMB shares on a Samba server is from CMD prompt

from a Windows device:
open CMD.exe
net use * \ip.of.open.hab\openhab-conf /user:.\openhab openhab

If the output is “Command completed Successfully” have a look in explorer for a mapping.

Hope this helps.

Thanks,
Andy

By default, windows will try to connect with the actual logged in user, but when failing it will open a login dialogue :slight_smile:

Correct, but I always provide username/password by clicking „connection with other account“.

I‘m logged in as „pi“ into my rpi and within windows I provide username openhab.

sudo journalctl -fu smbd provides:

-- Logs begin at Sun 2018-07-01 16:16:35 CEST. --
Jul 01 18:07:02 openhabianpi2 smbd[2187]: pam_unix(samba:session): session closed for user nobody
Jul 01 18:12:09 openhabianpi2 systemd[1]: Stopping Samba SMB Daemon...
Jul 01 18:12:09 openhabianpi2 systemd[1]: Stopped Samba SMB Daemon.
Jul 01 18:12:09 openhabianpi2 systemd[1]: Starting Samba SMB Daemon...
Jul 01 18:12:09 openhabianpi2 systemd[1]: smbd.service: Supervising process 2254 which is not our child. We'll most likely not notice when it exits.
Jul 01 18:12:09 openhabianpi2 systemd[1]: Started Samba SMB Daemon.
Jul 01 18:17:35 openhabianpi2 smbd[2351]: pam_unix(samba:session): session closed for user nobody
Jul 01 18:18:08 openhabianpi2 smbd[2364]: pam_unix(samba:session): session closed for user nobody
Jul 01 18:20:27 openhabianpi2 smbd[2386]: pam_unix(samba:session): session closed for user nobody
Jul 01 18:52:36 openhabianpi2 smbd[2703]: pam_unix(samba:session): session closed for user nobody

So what is the output if you try from CMD? As this will most likely tell us what is going on.

Also have you checked event viewer for any errors? Also drop your smbd.conf from /etc/samba/smbd.conf.

On your Windows 10 machine, is your network location set to public or private? And is your Windows firewall allow outbound SMB? If its public, you wont be able to connect to SMB shares on the local subnet. So try disabling the firewall and do the “net use” command from cmd.

The stock standard SMB config from openhabian is very open/insecure (depending on how you look at it). So if your experiencing issues, I would say it would be a network issue with your windows 10 device.

Andy

net use * \\192.168.xxxx.yyyy\openHAB2-conf /user:.\openhab openhab  
Systemfehler 86 aufgetreten.
Das angegebene Netzwerkkennwort ist falsch.

But it is excatly the same password it set with: sudo smbpasswd -a openhab

Don’t know, but there is another samba connection perfectly running for another openhab installation.

My smb.conf is

Press enter to see a dump of your service definitions

# Global parameters
[global]
        log file = /var/log/samba/log.%m
        max log size = 1000
        syslog = 0
        panic action = /usr/share/samba/panic-action %d
        usershare allow guests = Yes
        map to guest = Bad User
        obey pam restrictions = Yes
        pam password change = Yes
        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
        passwd program = /usr/bin/passwd %u
        server role = standalone server
        unix password sync = Yes
        dns proxy = No
        wins support = Yes
        idmap config * : backend = tdb


[homes]
        comment = Home Directories
        browseable = No
        create mask = 0700
        directory mask = 0700
        valid users = %S


[printers]
        comment = All Printers
        path = /var/spool/samba
        browseable = No
        printable = Yes
        create mask = 0700


[print$]
        comment = Printer Drivers
        path = /var/lib/samba/printers


[openHAB2-userdata]
        comment = openHAB2 userdata
        path = /var/lib/openhab2
        create mask = 0777
        directory mask = 0777
        read only = No


[openHAB2-conf]
        comment = openHAB2 site configuration
        path = /etc/openhab2
        create mask = 0777
        directory mask = 0777
        read only = No

I found out that my working samba share cannot be set up using windows cmd. The only way is using totalcmd (or windows explored supposedly).

net use * \\192.168.xxx.zzz\openHAB-conf /user:.\openhabian openhabian
Systemfehler 53 aufgetreten.

Der Netzwerkpfad wurde nicht gefunden.

which is definitely not the truth!

The problem is solved. I had to:

Run > Secpol.msc

then I set Local Policies > Security Options > Network Security: LAN Manager authentication level to 'Send NTLMv2 response only. Refuse LM & NTLM'

Wonder why my other samba share was (and still is) working fine, but I better don’t care too much.

Thanx @Udo_Hartmann and @SkyDivingGeek for your help!

1 Like

Ah. I’m pretty sure this is also configurable at samba itself.

@FrankR Try using your original command with the user as below.

The “.\” will cause an error 53. I verified it on my machine.

Danny

I took my samba.conf from the pi which can be connected and out onto the other one. But that did not help.

Correct @Thedannymullen.
The working command is:

net use O: \\openhabianpi\openHAB-conf /user:openhabian openhabian
3 Likes

Yes that looks correct. the difference is using

“net use *” vs “net use O:” is that the * will take the next available drive letter where * will take the next available. I have had issues in windows when the next available is in an unknown state.