OH3 permission issue ssh commands

  • Platform information:
    • Hardware: Raspberry Pi 3B
    • openHAB version: 3.2.0
  • Issue of the topic:

with Openhab 3 somehow i cant make my ssh Commands to other raspberry pis working again.

How I generate the key:

sudo -u openhab ssh-keygen -t rsa -f /etc/openhab/sshKeys/pi.id_rsa

Then i copy the key to another raspberry pi:

sudo -u openhab ssh -i /etc/openhab/sshKeys/pi.id_rsa USER@IP

Then it always fails to add the host to known_hosts file. I never need a password to ssh the other pi, but i always need to confirm i want to access

dont know why its failing

I´m thankfull for your hints! :bulb:

Do you already have a directory /var/lib/openhab/.ssh/?
ls -la /var/lib/openhab/ to show hidden files.
If not, create one:

sudo -u openhab mkdir /var/lib/openhab/.ssh/ 
sudo -u openhab chmod 700 /var/lib/openhab/.ssh/

Thanks for the fast response. Yes, I have the.ssh folder:

drwx------  2 openhab    openhab     4096 Apr  9 09:49 .ssh

And still no luck?
touch the file then:

sudo -u openhab touch /var/lib/openhab/.ssh/known_hosts

If the file exists, ensure it belongs to user openhab:

sudo chown openhab: /var/lib/openhab/.ssh/known_hosts
sudo -u openhab chmod 644 /var/lib/openhab/.ssh/known_hosts

1 Like

That’s was it! I could not touch the file due to permission issue, the other commands solved it.

I just wonder why the file in the openhab folder doesnt have permission for openhab. I just checked the .ssh folder.

Next time i know it better, thank you Udo :grin:

Maybe a backup issue :slight_smile:

1 Like