[SOLVED] Ssh openhabian@openhab chmod and mv errors

When ssh openhabian@openhab, this is what is displayed:

chrx:~$ ssh openhabian@openhab
Linux openhab 4.19.66-v7+ #1253 SMP Thu Aug 15 11:49:46 BST 2019 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Wed Oct  9 20:47:32 2019 from 192.168.22.54

2019-10-10 16:39:37,052: FireMotD: Info: Action "theme"
mv: cannot move '/tmp/tmp.WexrpkU63G' to '/usr/share/firemotd/data/FireMotD.json': Permission denied
chmod: changing permissions of '/usr/share/firemotd/data/FireMotD.json': Operation not permitted
mv: cannot move '/tmp/tmp.7kPYpkhlgS' to '/usr/share/firemotd/data/FireMotD.json': Permission denied
chmod: changing permissions of '/usr/share/firemotd/data/FireMotD.json': Operation not permitted
mv: cannot move '/tmp/tmp.Q2tfo4SocF' to '/usr/share/firemotd/data/FireMotD.json': Permission denied
chmod: changing permissions of '/usr/share/firemotd/data/FireMotD.json': Operation not permitted
mv: cannot move '/tmp/tmp.iFjYUvR0is' to '/usr/share/firemotd/data/FireMotD.json': Permission denied
chmod: changing permissions of '/usr/share/firemotd/data/FireMotD.json': Operation not permitted
chmod: changing permissions of '/usr/share/firemotd/data/FireMotD.json': Operation not permitted
mv: cannot move '/tmp/tmp.Sdp9D32Mta' to '/usr/share/firemotd/data/FireMotD.json': Permission denied
chmod: changing permissions of '/usr/share/firemotd/data/FireMotD.json': Operation not permitted
mv: cannot move '/tmp/tmp.FLaFRpKC5w' to '/usr/share/firemotd/data/FireMotD.json': Permission denied
chmod: changing permissions of '/usr/share/firemotd/data/FireMotD.json': Operation not permitted
mv: cannot move '/tmp/tmp.RYoVuUcAnl' to '/usr/share/firemotd/data/FireMotD.json': Permission denied
chmod: changing permissions of '/usr/share/firemotd/data/FireMotD.json': Operation not permitted
mv: cannot move '/tmp/tmp.gchGdKvAlo' to '/usr/share/firemotd/data/FireMotD.json': Permission denied
chmod: changing permissions of '/usr/share/firemotd/data/FireMotD.json': Operation not permitted
###############################################################################
###############  openhab  #####################################################
###############################################################################
##        Ip = 192.168.22.15
##   Release = Raspbian GNU/Linux 10 (buster)
##    Kernel = Linux 4.19.66-v7+
##  Platform = Raspberry Pi 3 Model B Rev 1.2
##    Uptime = 0 day(s). 2:21:45
## CPU Usage = 1.52% avg over 4 cpu(s) (4 core(s) x 1 socket(s))
##  CPU Load = 1m: 0.39, 5m: 0.26, 15m: 0.17
##    Memory = Free: 0.04GB (5%), Used: 0.90GB (95%), Total: 0.95GB
##      Swap = Free: 0.09GB (100%), Used: 0.00GB (0%), Total: 0.09GB
##      Root = Free: 25.08GB (90%), Used: 2.69GB (10%), Total: 28.99GB
##   Updates = 0 apt updates available.
##  Sessions = 1 session(s)
## Processes = 123 running processes of 32768 maximum processes
###############################################################################

              Welcome to            __  _____    ____  _
            ____  ____  ___  ____  / / / /   |  / __ )(_)___ _____
           / __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __  / / __ `/ __ \
          / /_/ / /_/ /  __/ / / / __  / ___ |/ /_/ / / /_/ / / / /
          \____/ .___/\___/_/ /_/_/ /_/_/  |_/_____/_/\__,_/_/ /_/
              /_/
                  openHAB 2.4.0-1 (Release Build)


Looking for a place to get started? Check out 'sudo openhabian-config' and the
documentation at https://www.openhab.org/docs/installation/openhabian.html
The openHAB dashboard can be reached at http://openhab:8080
To interact with openHAB on the command line, execute: 'openhab-cli --help'

[16:39:41] openhabian@openhab:~$ 

This happens even after a ‘fix permissions’ in openhabian-config

here are the ls -la


[16:51:55] openhabian@openhab:~$ ls -la /usr/share/firemotd/data
total 12
drwxr-xr-x 2 root root 4096 Oct 10 05:58 .
drwxr-xr-x 6 root root 4096 Oct  8 23:29 ..
-rwxrw-rw- 1 root root 3073 Oct 10 16:39 FireMotD.json
[16:52:16] openhabian@openhab:~$ ls -la /usr/share/firemotd     
total 24
drwxr-xr-x   6 root root 4096 Oct  8 23:29 .
drwxr-xr-x 112 1001 1001 4096 Oct  9 16:32 ..
drwxr-xr-x   2 root root 4096 Oct  9 11:04 cache
drwxr-xr-x   2 root root 4096 Oct 10 05:58 data
drwxr-xr-x   2 root root 4096 Oct  8 23:30 templates
drwxr-xr-x   2 root root 4096 Oct  9 11:03 themes
[16:52:35] openhabian@openhab:~$ 

which I see is root:root. Shouldn’t it be openhabian:openhabian? or openhabian:openhab? or root:openhabian? or some other iteration?

if so, should this correction be in the ‘fix permissions’? (not a criticism, just a question)

Thanks

This is a FireaMotD issue. For to a recent change to that third party software, the openhabian user needs permission to write to /usr/share/firemotd/data. I’m not sure why they do that as it’s pretty unusual. But they do, do you either need to chown that folder so openhabian owns it or chmod it so all users can work to it.

FireMotD is a third party software so openhab-cli isn’t going to addresses this.

1 Like

ok. thought something like that. I’d have probably put the changeable data in /var/lib/firemotd or something like that. But whatever.

Here’s the fix I put in, for whatever it’s worth:

(EDITED on 2019 Oct 15 to only affect the /usr/share/firemotd/data subdirectory, since that’s the only subdirectory that is actually written to.)

[16:52:35] openhabian@openhab:~$ sudo -s
[17:34:46] root@openhab:/home/openhabian# find /usr/share/firemotd/data -type d -exec setfacl -m d:g::rwx,g::rwx,d:g:openhabian:rwx,g:openhabian:rwx {} \;
[17:36:11] root@openhab:/home/openhabian# find /usr/share/firemotd/data -type f -exec setfacl -m g::rw,g:openhabian:rw {} \;
[17:37:05] root@openhab:/home/openhabian# find /usr/share/firemotd/data -type d -exec chmod g+s {} \;
[17:37:41] root@openhab:/home/openhabian# 

cheers

1 Like

Would you mind to create a PR for openHABian? TIA.

1 Like

can do.

unable to get past the captcha. Sorry.