Dear all, reading your posts it seems that the process of achieving auto-login to karaf console, without keying the password, is quite easy. But I can’t make it work following the process described above.
Being new to linux and after too many hours testing the process described here, studying similar posts like [SOLVED] Openhab default user password, Launch karaf console on openhab2, Automated execution of Karaf commands, Tutorial: Restart Binding from rule, How to solve Exec binding problems, How to restart bundles automatically (as I also want to execute command/scripts from within a rule) and many many attempts to make it work… I have given up ‘cause it is very frustrating not being able to find what’s wrong.
Just in case it might be of interest: I am using openHAB 3.2 installed on a Synology NAS and I am connecting to it from a Win7 PC with the help of WinSCP (Putty).
This is the process I’m following and its results step by step.
1. Login to Synology as user ‘jmvega’ and create openssh key pair
jmvega@DS918:~/.ssh$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/var/services/homes/jmvega/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /var/services/homes/jmvega/.ssh/id_rsa.
Your public key has been saved in /var/services/homes/jmvega/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:KkJ01kwKArd/6WDF8zT+Ensd3ZiCK3Azrp7bHpdYYL8 jmvega@DS918
The key's randomart image is:
+---[RSA 2048]----+
|+ o . |
| o o * |
| o + * = |
| . + . B + . . + |
| . + + S + o + .|
| . . + = O = o |
| . . o B E . |
| . . + * |
| .=oo |
+----[SHA256]-----+
jmvega@DS918:~/.ssh$
New files ‘id_rsa’ and ‘id_rsa.pub’ have been created under folder ‘/var/services/homes/jmvega/.ssh/
’
2. Copy the public key ‘id_rsa.pub’ to the Karaf keylist in /var/services/homes/openhab/userdata/etc/keys.properties
Contents of ‘id_rsa.pub’ is:
ssh-rsa AAAAB4Nzpsnrt1EAAAADAQABAAABAQDApTqnK8/YqaLaoW/uLcHbNSftX1WmYJrcNKHD2KmjU+avHHudBSSjArbI1umO70O3jrN1DcasdkjirgBEto+vV76fUCOf3kwZbLx4r73wZU4jkh43hkljwej435j4kxZawXENM3Fyy6ZkOCZpJOE6qK3DAmabDAVESICpmwewe674fgTIXG1wnxme4mqXy2LzUuvkdv9tr4qHtzZzkoJ9DFuWhOR8Vky8LMv+ooeibJK3XHL6WgJrYlyHhrDiT6/+RzhARpdsWZ2WjvyLdH9/DvG11ZUEP+gyaHU95vhcn6IAhL77sTGgc25FvTzN36Q4giydH/eIclBPHukpGkU7yG3RTLsB jmvega@DS918
File ‘/var/services/homes/openhab/userdata/etc/keys.properties’ is now modified with a new line that reads as:
openhab=AAAAB4Nzpsnrt1EAAAADAQABAAABAQDApTqnK8/YqaLaoW/uLcHbNSftX1WmYJrcNKHD2KmjU+avHHudBSSjArbI1umO70O3jrN1DcasdkjirgBEto+vV76fUCOf3kwZbLx4r73wZU4jkh43hkljwej435j4kxZawXENM3Fyy6ZkOCZpJOE6qK3DAmabDAVESICpmwewe674fgTIXG1wnxme4mqXy2LzUuvkdv9tr4qHtzZzkoJ9DFuWhOR8Vky8LMv+ooeibJK3XHL6WgJrYlyHhrDiT6/+RzhARpdsWZ2WjvyLdH9/DvG11ZUEP+gyaHU95vhcn6IAhL77sTGgc25FvTzN36Q4giydH/eIclBPHukpGkU7yG3RTLsB,_g_:admingroup
_g_\:admingroup = group,admin,manager,viewer,systembundles
3. Use the ssh client to connect to openHAB console
jmvega@DS918:~/.ssh$ ssh -p 8101 openhab@localhost
The authenticity of host '[localhost]:8101 ([127.0.0.1]:8101)' can't be established.
RSA key fingerprint is SHA256:/AdRnsXRg6jhgKUhqhTI1FTKRIyvXwoqVuu5Z83k3GqVPI.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[localhost]:8101' (RSA) to the list of known hosts.
Password authentication
Password:
__ _____ ____
____ ____ ___ ____ / / / / | / __ )
/ __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __ |
/ /_/ / /_/ / __/ / / / __ / ___ |/ /_/ /
\____/ .___/\___/_/ /_/_/ /_/_/ |_/_____/
/_/ 2.3.0
Release Build
Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown openHAB.
openhab>
And now a new file name ‘known_hosts’ has been created under folder ‘/var/services/homes/jmvega/.ssh/
However… If I logout and re-login with ‘ssh -p 8101 openhab@localhost
’, I am asked again to key the password (habopen). Why??
In order to get a better insight on what’s happening I do a login in verbose mode and this is the result:
openhab> logout
Connection to localhost closed.
jmvega@DS918:~/.ssh$ ssh -v -p 8101 openhab@localhost
OpenSSH_7.4p1, OpenSSL 1.0.2o-fips 27 Mar 2018
debug1: Connecting to localhost [127.0.0.1] port 8101.
debug1: Connection established.
debug1: identity file /var/services/homes/jmvega/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory**
debug1: identity file /var/services/homes/jmvega/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/services/homes/jmvega/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/services/homes/jmvega/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/services/homes/jmvega/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/services/homes/jmvega/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/services/homes/jmvega/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/services/homes/jmvega/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version SSHD-CORE-1.6.0
debug1: no match: SSHD-CORE-1.6.0
debug1: Authenticating to localhost:8101 as 'openhab'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: ecdh-sha2-nistp256
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:/AdRnsXRg6jhgKUhqhTI1FTKRIyvXwoqVuu5Z83k3GqVPI
debug1: Host '[localhost]:8101' is known and matches the RSA host key.
debug1: Found key in /var/services/homes/jmvega/.ssh/known_hosts:1
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: keyboard-interactive,password,publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /var/services/homes/jmvega/.ssh/id_rsa
debug1: Authentications that can continue: keyboard-interactive,password,publickey
debug1: Trying private key: /var/services/homes/jmvega/.ssh/id_dsa
debug1: Trying private key: /var/services/homes/jmvega/.ssh/id_ecdsa
debug1: Trying private key: /var/services/homes/jmvega/.ssh/id_ed25519
debug1: Next authentication method: keyboard-interactive
Password authentication
Password:
It attracts my attention the initial lines:
debug1: identity file /var/services/homes/jmvega/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory**
Why does it say “No such file or directory
” for “/var/services/homes/jmvega/.ssh/id_rsa
”. I can see the file!!
So… is it a matter of permissions?
In order to check if the issue is related to permissions I have assigned RW permissions to user ‘openhab’ over the folder ‘/var/services/homes/jmvega/.ssh/
’. I have also deleted file ‘known_hosts
’ so it can be recreated again once I login to karaf console (step 3 above). No luck. The result shown in the screen is exactly the same as above. So… I’m stuck.
I will very much appreciate your help to identify what I’m doing wrong.