[SOLVED] SSH into openhab user on Raspi

Until now I ssh’d to my user on my Raspberry Pi and then executed the following command to configure openHAB.

 sudo -u openhab mc /etc/openhab2 /var/lib/openhab2/

This requires me to type in my password.

Now I was wondering if I could ssh directly to the openhab user with my ssh-key.

The login seems to work, but I imidiately get logt out.

Aug  4 23:05:18 openhab sshd[19253]: Accepted publickey for openhab from 192.168.1.2 port 63795 ssh2: RSA 54:5d:e7:d7
:2a:ac:d8:a1:32:cf:c0:2a:e6:38:9d:4b
Aug  4 23:05:18 openhab sshd[19253]: pam_unix(sshd:session): session opened for user openhab by (uid=0)
Aug  4 23:05:18 openhab systemd-logind[383]: New session c229 of user openhab.
Aug  4 23:05:18 openhab systemd: pam_unix(systemd-user:session): session opened for user openhab by (uid=0)
Aug  4 23:05:18 openhab sshd[19258]: Received disconnect from 192.168.1.2: 11: disconnected by user
Aug  4 23:05:18 openhab sshd[19253]: pam_unix(sshd:session): session closed for user openhab
Aug  4 23:05:18 openhab systemd-logind[383]: Removed session c229.
Aug  4 23:05:18 openhab systemd: pam_unix(systemd-user:session): session closed for user openhab

Why?

btw: I am not using opanHabian, but installed openHAB manually via apt on my Raspi.

User and user openhab permissions issue? Not sure the exact location on your setup but /var/lib/pam I can see what permissions it has. Log mentions pam_unix so may be the best place to start.
If you have a spare RPI I would recommend openhabian, it takes care of all the leg work.

Found the issue.

Had to change passwd from

openhab:x:109:116:openhab2 runtime user,,,:/var/lib/openhab2:/bin/false

to

openhab:x:109:116:openhab2 runtime user,,,:/var/lib/openhab2:/bin/bash

Curious why are you using that user? Why not use the default user account?

My understanding is that openhab is the user for services to run under, not the one for day to day use.

I think its easier when creating and editing files (directly on the system), because I do not need to take care of file permissions.