Openhab2-conf submaps no access

Hey,

I would like to adjust my items and sitemaps with visual studio.
i have added the folders under windows with samba. These are also visible on my PC, but the only folder I don’t have full access to is the openHAB2-conf folder. I get to see the subfolders but cannot open them.
I tried on another pc but here is the same problem.

Can someone tell me what’s wrong?

Mijn smb.conf file:

netbios name = Pi
server string = The Pi File Center
workgroup = WORKGROUP

wins support = Yes

[HOMEPI]
patch = /home/pi
comment = No comment
browsable = yes
writeable=Yes
create mask=0777
directory mask=0777
public=no

[openHAB2-userdata]
  comment=openHAB2 userdata
  path=/var/lib/openhab2
  browseable=Yes
  writeable=Yes
  only guest=no
  public=no
  create mask=0777
  directory mask=0777

[openHAB2-conf]
  comment=openHAB2 site configuration
  path=/etc/openhab2
  browseable=Yes
  writeable=Yes
  only guest=no
  public=no
  create mask=0777
  directory mask=0777

[openHAB2-logs]
  comment=openHAB2 logs
  path=/var/log/openhab2
  browseable=Yes
  writeable=Yes
  only guest=no
  public=no
  create mask=0777
  directory mask=0777

[openHAB2-add-ons]
  comment=openHAB2 addons
  path=/usr/share/openhab2
  browseable=Yes
  writeable=Yes
  only guest=no
  public=no
  create mask=0777
  directory mask=0777

How did you install Samba? My preferred method is to use openHABian which configures full access to the conf folder by default.

I followed the steps on the site of openhab:

But I think there is more wrong. I can also no longer in the conf folder via ssh:

pi@Raspberry_pi_3:/etc/openhab2/items $ ls
ls: kan map '.' niet openen: Toegang geweigerd
pi@Raspberry_pi_3:/etc/openhab2/items $ cd /etc/openhab2/sitemaps
pi@Raspberry_pi_3:/etc/openhab2/sitemaps $ ls
ls: kan map '.' niet openen: Toegang geweigerd
pi@Raspberry_pi_3:/etc/openhab2/sitemaps $

And I can no longer use my basicUI, it doesn’t find my sitemap.
This all worked before i tried to access the files true samba.

Package-based or manual installation? Please post your smb.conf in code fences here.

manual installation.

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

# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
   read only = yes

# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
   create mask = 0700

# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
  directory mask = 0700

# By default, \\server\username shares can be connected to by anyone
# with access to the samba server.
# The following parameter makes sure that only "username" can connect
# to \\server\username
# This might need tweaking when using external authentication schemes
   valid users = %S

# Un-comment the following and create the netlogon directory for Domain Logons
# (you need to configure Samba to act as a domain controller too.)
;[netlogon]
;   comment = Network Logon Service
;   path = /home/samba/netlogon
;   guest ok = yes
;   read only = yes

# Un-comment the following and create the profiles directory to store
# users profiles (see the "logon path" option above)
# (you need to configure Samba to act as a domain controller too.)
# The path below should be writable by all users so that their
# profile directory may be created the first time they log on
;[profiles]
;   comment = Users profiles
;   path = /home/samba/profiles
;   guest ok = no
;   browseable = no
;   create mask = 0600
;   directory mask = 0700
[printers]
   comment = All Printers
   browseable = 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 = yes
   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

[openHAB2-userdata]
  comment=openHAB2 userdata
  path=/var/lib/openhab2
  browseable=Yes
  writeable=Yes
  only guest=no
  public=no
  create mask=0777
  directory mask=0777

[openHAB2-conf]
  comment=openHAB2 site configuration
  path=/etc/openhab2
  browseable=Yes
  writeable=Yes
  only guest=no
  public=no
  create mask=0777
  directory mask=0777

[openHAB2-logs]
  comment=openHAB2 logs
  path=/var/log/openhab2
  browseable=Yes
  writeable=Yes
  only guest=no
  public=no
  create mask=0777
  directory mask=0777

Looking closer, is your OH installation manual? If so, your shares are pointed at the wrong location.

Hey,

happy New Year!

I’m wrong, it’s a package-based installation, so the location of the folders is correct.

The strange thing is that I have been working with openhab for half a year and that I have already reached the point where I had already created some items and a sitemap. I edit the ‘items’ and sitemap’ files with ‘SSH’ and ‘nano’ editor.
I had the samba shares working until yesterday and was perfectly able to use the ‘openhab-conf’ folder with Windows 10. But I couldn’t make any changes to my items and sitemap file, because i wanted to use visual studio code for further programming the files. That’s why I had uninstalled and reinstalled samba, but now it doesn’t work at all anymore.

I’m pretty sure that somewhere there is a problem with the rights of the “openhab-conf” folder. in SSH I can only change things with ‘sudo’ in this folder. in the past this could be done without.
I also no longer see my sitemap in the ‘basic UI’ while this used to work.
With WinSCP I also cannot access the ‘openhab-conf’ files.

pi@Raspberry_pi_3:/etc/openhab2/sitemaps $ ls
ls: kan map '.' niet openen: Toegang geweigerd
pi@Raspberry_pi_3:/etc/openhab2/sitemaps $ sudo ls
readme.txt  thuis.sitemap
pi@Raspberry_pi_3:/etc/openhab2/sitemaps $ cd /etc/openhab2/sitemaps
pi@Raspberry_pi_3:/etc/openhab2/sitemaps $ ls
ls: kan map '.' niet openen: Toegang geweigerd
pi@Raspberry_pi_3:/etc/openhab2/sitemaps $ sudo ls
readme.txt  thuis.sitemap
pi@Raspberry_pi_3:/etc/openhab2/sitemaps $ cd /etc/openhab2
pi@Raspberry_pi_3:/etc/openhab2 $ ls
html  icons  items  persistence  rules  scripts  services  sitemaps  sounds  things  transform
pi@Raspberry_pi_3:/etc/openhab2 $

My conf folder tree is owned by the user openhab. that should be the user you use when connecting to the share.

openhab@debian-01:/etc/openhab2$ ls -al
total 64
drwxr-xr-x+ 15 openhab openhab 4096 Nov  7 18:44 .
drwxr-xr-x  88 root    root    4096 Dec 16 18:39 ..
drwxrwxr-x+  5 openhab openhab 4096 Oct 13 19:40 automation
drwxrwxr-x+ 10 openhab openhab 4096 Oct 27 16:56 bwo
drwxrwxr-x+  2 openhab openhab 4096 Dec 18 19:44 html
drwxrwxr-x+  3 openhab openhab 4096 Oct 17 18:08 icons
drwxrwxr-x+  2 openhab openhab 4096 Dec 18 19:44 items
drwxrwxr-x+  2 openhab openhab 4096 Dec 18 19:44 persistence
drwxrwxr-x+  3 openhab openhab 4096 Dec 18 19:44 rules
drwxrwxr-x+  2 openhab openhab 4096 Dec 18 19:44 scripts
drwxrwxr-x+  2 openhab openhab 4096 Dec 18 19:45 services
drwxrwxr-x+  2 openhab openhab 4096 Dec 18 19:44 sitemaps
drwxrwxr-x+  2 openhab openhab 4096 Dec 18 19:44 sounds
drwxrwxr-x+  2 openhab openhab 4096 Dec 18 19:44 things
drwxrwxr-x+  2 openhab openhab 4096 Dec 18 19:44 transform

You could try sudo chown -R openhab:openhab /etc/openhab2 That recursively sets the ownership of that directory tree.

I suspect something is wrong with the permissions of the directories?

pi@Raspberry_pi_3:/etc $ cd /etc/openhab2
pi@Raspberry_pi_3:/etc/openhab2 $ sudo ls -al
totaal 60
drwxrwxrwx  13 openhab openhab  4096 dec 25 14:14 .
drwxr-xr-x 120 root    root    12288 jan  1 14:28 ..
d-wx--x--x   2 openhab openhab  4096 jun 29  2019 html
d-wx--x--x   3 openhab openhab  4096 jun 15  2019 icons
d-wx--x--x   2 openhab openhab  4096 jan  1 13:35 items
d-wx--x--x   2 openhab openhab  4096 jun 29  2019 persistence
d-wx--x--x   2 openhab openhab  4096 jun 29  2019 rules
d-wx--x--x   2 openhab openhab  4096 jun 29  2019 scripts
d-wx--x--x   2 openhab openhab  4096 jun 29  2019 services
d-wx--x--x   2 openhab openhab  4096 jan  1 13:36 sitemaps
d-wx--x--x   2 openhab openhab  4096 jun 29  2019 sounds
d-wx--x--x   2 openhab openhab  4096 jun 29  2019 things
d-wx--x--x   2 openhab openhab  4096 jun 29  2019 transform
pi@Raspberry_pi_3:/etc/openhab2 $

Correct. Try this sudo chmod -R ug=rwx /etc/openhab2 Assuming you have run my previous chown command this whould correct the permissions to make them usable. Technically it makes the configuration files executable but that permission is needed for any subfolders.

Hi,

I’ve tried sudo chmod -R ug=rwx /etc/openhab2
ls -al now gives the following:

pi@Raspberry_pi_3:/etc/openhab2 $ ls -al
totaal 60
drwxrwxrwx  13 openhab openhab  4096 dec 25 14:14 .
drwxr-xr-x 120 root    root    12288 jan  1 14:28 ..
drwxrwx--x   2 openhab openhab  4096 jun 29  2019 html
drwxrwx--x   3 openhab openhab  4096 jun 15  2019 icons
drwxrwx--x   2 openhab openhab  4096 jan  1 13:35 items
drwxrwx--x   2 openhab openhab  4096 jun 29  2019 persistence
drwxrwx--x   2 openhab openhab  4096 jun 29  2019 rules
drwxrwx--x   2 openhab openhab  4096 jun 29  2019 scripts
drwxrwx--x   2 openhab openhab  4096 jun 29  2019 services
drwxrwx--x   2 openhab openhab  4096 jan  1 13:36 sitemaps
drwxrwx--x   2 openhab openhab  4096 jun 29  2019 sounds
drwxrwx--x   2 openhab openhab  4096 jun 29  2019 things
drwxrwx--x   2 openhab openhab  4096 jun 29  2019 transform

But does not make any difference to the files in it:

pi@Raspberry_pi_3:/etc/openhab2/sitemaps $ ls
ls: kan map '.' niet openen: Toegang geweigerd
pi@Raspberry_pi_3:/etc/openhab2/sitemaps $ sudo ls -al
totaal 16
drwxrwx--x  2 openhab openhab 4096 jan  1 13:36 .
drwxrwxrwx 13 openhab openhab 4096 dec 25 14:14 ..
-rwxrwxr--  1 openhab openhab  241 jun 13  2019 readme.txt
-rwxrwxr--  1 openhab openhab  415 jan  1 13:10 thuis.sitemap

And is it normal that when i try to log in with user ‘openhab’ in Putty? When i give my password Putty shuts down?

The user openhab has no login shell so that is probably normal. You are trying to access the files as user pi but openhab runs as the user openhab.
You are running on a Raspberry Pi. How did you install openHAB?
Using a package installation?
Installing openHABian on Raspbian?

What username are you using in Samba from Windows to connect to the conf directory?

I need to check a similar installation at home to try and figure out the permissions.

OK I just double checked on a fresh openHABian install on Raspbian.

type `sudo grep openhab /etc/group to verify group memberships. Here is my results.

tty:x:5:openhab,pi
dialout:x:20:pi,openhab
audio:x:29:pi,openhab
bluetooth:x:112:openhab,pi
gpio:x:997:pi,openhab
openhab:x:115:pi

Notice the last line. The user pi also belongs to the group openhab.
I suspect this is your issue. Post your output and we can try to fix it up.

Hi,

My output:

pi@Raspberry_pi_3:~ $ sudo grep openhab /etc/group
tty:x:5:openhab
dialout:x:20:pi,openhab
sudo:x:27:pi,openhab
audio:x:29:pi,openhab
bluetooth:x:111:openhab
openhab:x:115:

I just tried to reach the samba share with Windows and this works now. I use the user openhab.
My sitemap also works in the basicUI again.
I can now adjust the files with visual studio code.

What is your OS? The group file does not look like Raspbian. I think the pi user needs to be added to the openhab group so that user can access the config files too.

I use Windows 10.
And I’m pretty sure I installed Raspian, can I check this somewhere?
I installed openhab with Package Repository Installation.

I now notice something strange, I sometimes connect with the Raspberry with VNC but I can now no longer log in with user Pi. When I try this he seems to want to log in but always come back to the login screen and get no error message. I can log in with user openhab, and then I get the message that user Pi is connected?

OK that could explain the differences. Let me try that

By default, the package based install does not provide access to OH my the Pi user. This command should add that but you need to logout and back in to take effect.

sudo usermod -a -G openhab pi

It looks like it works now :slight_smile:
I have had to delete and recreate my items and sitemap file, only then could I edit it.
I think everything will be fine now?

Thank you very much for your help !!

1 Like