Windows 10 unable to connect to OpenHabian samba shares

Openhabian 4.19.75-v7+ armv7l
OH 2
Windows 10


Trying to access shares from Win10 client , so that I can use VS Code to edit files, etc.

First, install smb using Turn Windows Features On or Off utility in Win10. Successfully installs and reports SMB 1,9/CIFS File Share Support. installed .

Next, Used option 66 from openhabian-config to install smbd (Samba). No errors.

Check version:

[16:52:44] openhabian@openhab:~$ smbd --version
Version 4.9.5-Debian

Then confirmed status:

[16:34:04] openhabian@openhab:~$ systemctl status smbd.service
â—Ź smbd.service - Samba SMB Daemon
   Loaded: loaded (/lib/systemd/system/smbd.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2020-01-08 16:31:56 GMT; 2min 12s ago
     Docs: man:smbd(8)
           man:samba(7)
           man:smb.conf(5)
  Process: 6927 ExecStartPre=/usr/share/samba/update-apparmor-samba-profile (code=exited, status=0/SUCCESS)
 Main PID: 6928 (smbd)
   Status: "smbd: ready to serve connections..."
    Tasks: 4 (limit: 2319)
   Memory: 4.3M
   CGroup: /system.slice/smbd.service
           ├─6928 /usr/sbin/smbd --foreground --no-process-group
           ├─6931 /usr/sbin/smbd --foreground --no-process-group
           ├─6932 /usr/sbin/smbd --foreground --no-process-group
           └─6933 /usr/sbin/smbd --foreground --no-process-group

Jan 08 16:31:56 openhab systemd[1]: Starting Samba SMB Daemon...
Jan 08 16:31:56 openhab systemd[1]: Started Samba SMB Daemon.

I have not made any changes to the config file as it is supposed to work out of the box:
So next, check smbd.config file and log file.

/etc/samba/smb.conf

[16:37:22] openhabian@openhab:~$ cat   /etc/samba/smb.conf
#
# Sample configuration file for the Samba suite for Debian GNU/Linux.
#
#
# This is the main Samba configuration file. You should read the
# smb.conf(5) manual page in order to understand the options listed
# here. Samba has a huge number of configurable options most of which
# are not shown in this example
#
# Some options that are often worth tuning have been included as
# commented-out examples in this file.
#  - When such options are commented with ";", the proposed setting
#    differs from the default Samba behaviour
#  - When commented with "#", the proposed setting is the default
#    behaviour of Samba but the option is considered important
#    enough to be mentioned here
#
# NOTE: Whenever you modify this file you should run the command
# "testparm" to check that you have not made any basic syntactic
# errors.

#======================= Global Settings =======================

[global]

## Browsing/Identification ###

# Change this to the workgroup/NT-domain name your Samba server will part of
  workgroup = WORKGROUP

# Windows Internet Name Serving Support Section:
# WINS Support - Tells the NMBD component of Samba to enable its WINS Server
  wins support = yes

# WINS Server - Tells the NMBD components of Samba to be a WINS Client
# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
;   wins server = w.x.y.z

# This will prevent nmbd to search for NetBIOS names through DNS.
  dns proxy = no

#### Networking ####

# The specific set of interfaces / networks to bind to
# This can be either the interface name or an IP address/netmask;
# interface names are normally preferred
;   interfaces = 127.0.0.0/8 eth0

# Only bind to the named interfaces and/or networks; you must use the
# 'interfaces' option above to use this.
# It is recommended that you enable this feature if your Samba machine is
# not protected by a firewall or is a firewall itself.  However, this
# option cannot handle dynamic or non-broadcast interfaces correctly.
;   bind interfaces only = yes



#### Debugging/Accounting ####

# This tells Samba to use a separate log file for each machine
# that connects
  log file = /var/log/samba/log.%m

# Cap the size of the individual log files (in KiB).
  max log size = 1000

# If you want Samba to only log through syslog then set the following
# parameter to 'yes'.
#   syslog only = no

# We want Samba to log a minimum amount of information to syslog. Everything
# should go to /var/log/samba/log.{smbd,nmbd} instead. If you want to log
# through syslog you should set the following parameter to something higher.
  syslog = 0

# Do something sensible when Samba crashes: mail the admin a backtrace
;   panic action = /usr/share/samba/panic-action %d


####### Authentication #######

# Server role. Defines in which mode Samba will operate. Possible
# values are "standalone server", "member server", "classic primary
# domain controller", "classic backup domain controller", "active
# directory domain controller".
#
# Most people will want "standalone sever" or "member server".
# Running as "active directory domain controller" will require first
# running "samba-tool domain provision" to wipe databases and create a
# new domain.
  server role = standalone server

# If you are using encrypted passwords, Samba will need to know what
# password database type you are using.
  passdb backend = tdbsam
  obey pam restrictions = yes

# This boolean parameter controls whether Samba attempts to sync the Unix
# password with the SMB password when the encrypted SMB password in the
# passdb is changed.
  unix password sync = yes

# For Unix password sync to work on a Debian GNU/Linux system, the following
# parameters must be set (thanks to Ian Kahan <<kahan@informatik.tu-muenchen.de> for
# sending the correct chat script for the passwd program in Debian Sarge).
  passwd program = /usr/bin/passwd %u
  passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .

# This boolean controls whether PAM will be used for password changes
# when requested by an SMB client instead of the program listed in
# 'passwd program'. The default is 'no'.
  pam password change = yes

# This option controls how unsuccessful authentication attempts are mapped
# to anonymous connections
  map to guest = bad user

########## Domains ###########

#
# The following settings only takes effect if 'server role = primary
# classic domain controller', 'server role = backup domain controller'
# or 'domain logons' is set
#

# It specifies the location of the user's
# profile directory from the client point of view) The following
# required a [profiles] share to be setup on the samba server (see
# below)
;   logon path = \\%N\profiles\%U
# Another common choice is storing the profile in the user's home directory
# (this is Samba's default)
#   logon path = \\%N\%U\profile

# The following setting only takes effect if 'domain logons' is set
# It specifies the location of a user's home directory (from the client
# point of view)
;   logon drive = H:
#   logon home = \\%N\%U

# The following setting only takes effect if 'domain logons' is set
# It specifies the script to run during logon. The script must be stored
# in the [netlogon] share
# NOTE: Must be store in 'DOS' file format convention
;   logon script = logon.cmd

# This allows Unix users to be created on the domain controller via the SAMR
# RPC pipe.  The example command creates a user account with a disabled Unix
# password; please adapt to your needs
; add user script = /usr/sbin/adduser --quiet --disabled-password --gecos "" %u

# This allows machine accounts to be created on the domain controller via the
# SAMR RPC pipe.
# The following assumes a "machines" group exists on the system
; add machine script  = /usr/sbin/useradd -g machines -c "%u machine account" -d /var/lib/samba -s /bin/false %u

# This allows Unix groups to be created on the domain controller via the SAMR
# RPC pipe.
; add group script = /usr/sbin/addgroup --force-badname %g

############ Misc ############

# Using the following line enables you to customise your configuration
# on a per machine basis. The %m gets replaced with the netbios name
# of the machine that is connecting
;   include = /home/samba/etc/smb.conf.%m

# Some defaults for winbind (make sure you're not using the ranges
# for something else.)
;   idmap uid = 10000-20000
;   idmap gid = 10000-20000
;   template shell = /bin/bash

# Setup usershare options to enable non-root users to share folders
# with the net usershare command.

# Maximum number of usershare. 0 (default) means that usershare is disabled.
;   usershare max shares = 100

# Allow users who've been granted usershare privileges to create
# public shares, not just authenticated ones
;   usershare allow guests = yes

#======================= Share Definitions =======================

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

[printers]
   comment = All Printers
   browseable = no
   public = no
   path = /var/spool/samba
   printable = yes
   guest ok = no
   read only = yes
   create mask = 0700

# Windows clients look for this share name as a source of downloadable
# printer drivers
[print$]
   comment = Printer Drivers
   path = /var/lib/samba/printers
   browseable = no
   public = no
   read only = yes
   guest ok = no
# Uncomment to allow remote administration of Windows print drivers.
# You may need to replace 'lpadmin' with the name of the group your
# admin users are members of.
# Please note that you also need to set appropriate Unix permissions
# to the drivers directory for these users to have write rights in it
;   write list = root, @lpadmin

#=================== Custom Share Definitions ====================

[openHAB-share]
  comment=openHAB2 combined folders
  path=/srv
  writeable=yes
  public=no
  create mask=0664
  directory mask=0775
  veto files = /Thumbs.db/.DS_Store/._.DS_Store/.apdisk/._*/
  delete veto files = yes

[openHAB-conf]
  comment=openHAB2 site configuration
  path=/etc/openhab2
  writeable=yes
  public=no
  create mask=0664
  directory mask=0775
  veto files = /Thumbs.db/.DS_Store/._.DS_Store/.apdisk/._*/
  delete veto files = yes

;[openHAB-userdata]
;  comment=openHAB2 userdata
;  path=/var/lib/openhab2
;  writeable=yes
;  public=no
;  create mask=0664
;  directory mask=0775
;  veto files = /Thumbs.db/.DS_Store/._.DS_Store/.apdisk/._*/
;  delete veto files = yes

;[openHAB-sys]
;  comment=openHAB2 application
;  path=/usr/share/openhab2
;  writeable=yes
;  public=no
;  create mask=0664
;  directory mask=0775
;  veto files = /Thumbs.db/.DS_Store/._.DS_Store/.apdisk/._*/
;  delete veto files = yes

;[openHAB-log]
;  comment=openHAB2 log files
;  path=/var/log/openhab2
;  writeable=yes
;  public=no
;  create mask=0664
;  directory mask=0775
;  veto files = /Thumbs.db/.DS_Store/._.DS_Store/.apdisk/._*/
;  delete veto files = yes

;[var-www]
;  comment=webserver files
;  path=/var/www
;  writeable=yes
;  only guest=no
;  public=no
;  create mask=0664
;  directory mask=0775
;  veto files = /Thumbs.db/.DS_Store/._.DS_Store/.apdisk/._*/
;  delete veto files = yes

;[opt]
;  comment=opt folder
;  path=/opt
;  writeable=yes
;  only guest=no
;  public=no
;  create mask=0664
;  directory mask=0775
;  veto files = /Thumbs.db/.DS_Store/._.DS_Store/.apdisk/._*/
;  delete veto files = yes

# vim: filetype=samba
[16:37:26] openhabian@openhab:~$

/var/log/samba/log.smbd

[16:40:20] openhabian@openhab:~$ cat   /var/log/samba/log.smbd
[2020/01/05 01:17:10.782480,  0] ../lib/util/become_daemon.c:138(daemon_ready)
  daemon_ready: STATUS=daemon 'smbd' finished starting up and ready to serve connections
[2020/01/06 16:18:36.853877,  0] ../lib/util/become_daemon.c:138(daemon_ready)

Then tried to add share in Windows 10, the folder tree correctly shows the openHAB-conf and openHAB-share.

However, when I click on one, Windows asks fof the password for user openhab but when I enter the openhab password, Windows credentials says “incorrect username of password”. I tried sudo passwd openhab to reset password, still not joy. I tried using different credentials from Windows, such as openhabian and that password, no joy. I can ssh into openhabian (raspberry Pi) using openhabian username and relevant password so I know it is not the password that is the problem. Aside, I am sure the correct user login for samba is openhab plus the password I set using sudo passwd openhab

Just will not allow me to connect?

I do not use Windows but have read that others needed to assign a drive letter (in windows) for the samba share to work and/or add folder name.

@tillykeats From other post:
You need to add the folder name as part of the mapping address ie \192.168.1.221\OpenHAB-conf

Tried that, didn’t work.
Also tried removing smb v1 from Windows as it is deprecated.
And connecting using qualified path as in \openhab\OpenHAB-conf , no joy!

I dont use windows much either but there is no VS Code for armfh architecture.I only need these shares so I can edit remotely on VS Code on Win10.

Did you try the drive letter assignment?

I remember that I had the same issue until I assigned a drive letter to the OH path, in my case:
O: \OPENHABIANPI.local\openHAB-conf

I did.
Also tried using command line in Win…

C:\Users\daz>net use \\openhab\OpenHAB-conf
The password is invalid for \\openhab\OpenHAB-conf.

Enter the username for 'openhab': openhab
Enter the password for openhab:
System error 1219 has occurred.

Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed. Disconnect all previous connections to the server or shared resource and try again.

suggests resource already in use ?? So I checked…

C:\Users\daz>net share

Share name   Resource                        Remark

-------------------------------------------------------------------------------
C$           C:\                             Default share
IPC$                                         Remote IPC
ADMIN$       C:\WINDOWS                      Remote Admin
Users        C:\Users
The command completed successfully.

What is the output of (on your OH server) of openhab-cli info

[17:48:38] openhabian@openhab:~$ openhab-cli info

Version:     2.5.1-SNAPSHOT (#8)

User:        openhab (Active Process 464)
User Groups: openhab tty dialout audio bluetooth gpio

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.1.253:8080
             https://192.168.1.253:8443

[17:48:44] openhabian@openhab:~$

The above looks correct as does your smb.config

Restart samba and try using both // and \\ as in docs.

  • On Windows: Open Windows Explorer → Address bar: \\openhab-device.local → Right click a share and assign a drive letter

Be sure to use the actual host name instead of openhab-device . When asked, authenticate with the username “openhab” and the chosen password. If you are not able to connect, try with the IP of your device (e.g. smb://openhab@192.168.0.2 or \\192.168.0.2 ).

EDIT:
Looking at the docs for installing via the openhabian image install the user name and password by default is openhabian.

Since installing OH and starting samba have you tried a reboot or cache clean?

sudo systemctl stop openhab2

sudo openhab-cli clean-cache

sudo systemctl start openhab2 or sudo reboot

Access denied!

That what I get whatever I try. Openhabian is not allowing the connection. There is nothing wrong on the windows side according to even logs for app, security and wundows itself.

I tried from the shell in windows:

C:\Users\daz>net use /user:openhab \\192.168.1.253\OpenHAB-conf  <passwordr>
System error 5 has occurred.

Access is denied.

@tillykeats See my EDIT above.

Also do you have a linux PC that you can use and try with: smb://192.168.1.253 and see if you can connect?

Still, Access is denied!

No other box, just the Windows and Pi.

However, since committing your commands above, I have now lost all web apps on openhab bar the LogViewer and Help. No PaperUI, no WebPanel, no basic Config. So I could do with your help to re-instate these now, please; they were working before those commands .I have rebooted to no effect.

EDIT: *** Oops. they are back now. Just took a long time.

It takes OH a few minuets to restart after cleaning the cache.

yes, see my edit above.

still no shares accessible.

Other then trying a reboot on your PC and using: smb://openhabian@192.168.1.253 or smb:\\192.168.1.253 for network connection I’m out of idea’s.

Sorry I could not help, maybe @Bruce_Osborne has some advice.

@Bruce_Osborne I see you replying and thanks in advance Bruce. :+1: I gotta run, will check back in a bit.

As soon as I saw this I moved on.

You cannot run an OS for ARM CPUs and an OS for x86 CPUs on the same computer, without some sort of emulation layer.

If OH was running on Windows 10, Samba would not be needed unless the client runs Linux. If OH is not on Windows 10, file sharing did not need to be turned on.

I am not going to sort through that mess,

Hey, well thanks for trying.

I have rebooted both PC and Openhabian boxes to no avail.
I just dont get it.

@Bruce_Osborne they are on different machines
Openhabian 4.19.75-v7+ arm7l is on one box (the Raspberry Pi)
OH2 (is on the Pi because I am running Openhaban as per previous line , which clearly is the container for OH)
Windows10 is on the PC

Of course it’s not possible to run both on the same box unless running the Linux susbsystem for Win or a VM - so I didnt feel the need to state the obvious.

I tried removing the SMB1 from Windows and that didnt work either.

EDIT: I am actually conversant with Linux, it is Windows I do not use that often.

Ok ,so I stopped the smbd daemon and run it in the foreground with debuglevel=3 . It appears smbd doe not think user openhab is in the passwd …

check_ntlm_password:  Checking password for unmapped user [LianLiPC-7NB]\[openhab]@[LianLiPC-7NB] with the new password interface
check_ntlm_password:  mapped user is: [LianLiPC-7NB]\[openhab]@[LianLiPC-7NB]
check_sam_security: Couldn't find user 'openhab' in passdb.
check_ntlm_password:  Authentication for user [openhab] -> [openhab] FAILED with error NT_STATUS_NO_SUCH_USER, authoritative=1
Auth: [SMB2,(null)] user [LianLiPC-7NB]\[openhab] at [Wed, 08 Jan 2020 18:34:58.437539 GMT] with [NTLMv2] status [NT_STATUS_NO_SUCH_USER] workstation [LianLiPC-7NB] remote host [ipv4:192.168.1.197:49967] mapped to [LianLiPC-7NB]\[openhab]. local host [ipv4:192.168.1.253:445]
{"timestamp": "2020-01-08T18:34:58.438055+0000", "type": "Authentication", "Authentication": {"version": {"major": 1, "minor": 0}, "status": "NT_STATUS_NO_SUCH_USER", "localAddress": "ipv4:192.168.1.253:445", "remoteAddress": "ipv4:192.168.1.197:49967", "serviceDescription": "SMB2", "authDescription": null, "clientDomain": "LianLiPC-7NB", "clientAccount": "openhab", "workstation": "LianLiPC-7NB", "becameAccount": null, "becameDomain": null, "becameSid": null, "mappedAccount": "openhab", "mappedDomain": "LianLiPC-7NB", "netlogonComputer": null, "netlogonTrustAccount": null, "netlogonNegotiateFlags": "0x00000000", "netlogonSecureChannelType": 0, "netlogonTrustAccountSid": null, "passwordType": "NTLMv2", "duration": 15649}}
No such user openhab [LianLiPC-7NB] - using guest account
Allowed connection from 192.168.1.197 (192.168.1.197)
create_connection_session_info: guest user (from session setup) not permitted to access this share (openHAB-share)
create_connection_session_info failed: NT_STATUS_ACCESS_DENIED
smbd_smb2_request_error_ex: smbd_smb2_request_error_ex: idx[1] status[NT_STATUS_ACCESS_DENIED] || at ../source3/smbd/smb2_tcon.c:138
Server exit (NT_STATUS_CONNECTION_RESET)

I tried the other 2 accounts I have on openhabian, none of those credentials work either. This led me to conclude that no users are in the smb password file NOTE: This is not the same as the OS passwd db

[18:46:33] root@openhab:/home/openhabian# smbpasswd -a openhab
New SMB password:
Retype new SMB password:
Added user openhab.
[18:46:56] root@openhab:/home/openhabian#

FIXED.

So @Bruce_Osborne and @H102, it appears that the openhab or openhabian users , were not in the passdb file and needed adding. Has anyone managed to replicate this with Openhabian one wonders?

3 Likes

Samba (smbd) do not use the password file. They use their own (smbpasswd?) file.

Yes, i know, but i had presumed the openhab user had been added to passdb for smb, but it was not the case. I read the docs which made no reference to users having to apply this fix. some users would not know how to accomplish this.
??

I use it with openHABian at home installed through their config. I have a test system too but may not be able to spend much time checking.
@mstormi is the openhabian expert here.