NextcloudPi auf Raspberry, V 1.36.3
Szenario:
Die Daten von meinem Nextcloudpi sollen auf meinem Backupserver (192.168.2.100) per rsyc gesichert werden. Das ganze möchte mich mittels ssh und einem passwortfreiem Schlüssellogin ermöglichen.
Problem: Der ssh-login klappt nicht, ich werde nach einem PW gefragt.
Was ich gemacht habe:
-
Testen, ob der SSH-Login grundsätzlich vom pi aus mit dem sync-User (syncer) funktioniert:
pi@nextcloudpi:~$ ssh -l syncer 192.168.2.100
syncer@server’s password: *******
syncer@server:~$ exit
pi@nextcloudpi:~$
Hat funktioniert!
-
Auf dem Pi ein Passwortfreies Schlüsselpaar erstellen:
pi@nextcloudpi:~$ cd .ssh
pi@nextcloudpi:.ssh$ ssh-keygen -t rsa -f syncer.identity
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase): hier wurde KEIN PW eingeben, nur mit Return bestätigt
Enter same passphrase again:
Your identification has been saved in syncer.identity.
Your public key has been saved in syncer.identity.pub. -
Public-Key auf server übertragen:
pi@nextcloudpi:~$ scp syncer.identity.pub syncer@192.168.2.100:~
pi@nextcloudpi:~$ ssh -l syncer 192.168.2.100 -
… und diesen Schlüssel an die Datei ~/.ssh/authorized_keys anhängen:
syncer@server:~$ ! [ -e .ssh ] && mkdir .ssh
syncer@server:~$ chmod 700 .ssh
syncer@server:~$ cat syncer.identity.pub >> .ssh/authorized_keys
syncer@server:~$ chmod 600 .ssh/authorized_keys
syncer@server:~$ exit -
Passwort-freien Login testen:
pi@nextcloudpi:~$ ssh syncer@192.168.2.100
… und ab hier läufts nicht mehr wie erwartet: Ich werde aufgefordert, das PW einzugeben.
Ich hab das genau so mit drei Clients schon gemacht (auf dem gleichen Server) - das hat überall geklappt, nur die Nectcloud macht Probleme.
Hier die Ausgabe von ssh -v syncer@192.168.2.100
OpenSSH_7.9p1 Raspbian-10+deb10u2, OpenSSL 1.1.1d 10 Sep 2019
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 192.168.2.100 [192.168.2.100] port 22.
debug1: Connection established.
debug1: identity file /home/pi/.ssh/id_rsa type -1
debug1: identity file /home/pi/.ssh/id_rsa-cert type -1
debug1: identity file /home/pi/.ssh/id_dsa type -1
debug1: identity file /home/pi/.ssh/id_dsa-cert type -1
debug1: identity file /home/pi/.ssh/id_ecdsa type -1
debug1: identity file /home/pi/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/pi/.ssh/id_ed25519 type -1
debug1: identity file /home/pi/.ssh/id_ed25519-cert type -1
debug1: identity file /home/pi/.ssh/id_xmss type -1
debug1: identity file /home/pi/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9p1 Raspbian-10+deb10u2
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2p1 Ubuntu-4ubuntu0.2
debug1: match: OpenSSH_8.2p1 Ubuntu-4ubuntu0.2 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 192.168.2.100:22 as 'syncer'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:xxx
debug1: Host '192.168.2.100' is known and matches the ECDSA host key.
debug1: Found key in /home/pi/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: Will attempt key: /home/pi/.ssh/id_rsa
debug1: Will attempt key: /home/pi/.ssh/id_dsa
debug1: Will attempt key: /home/pi/.ssh/id_ecdsa
debug1: Will attempt key: /home/pi/.ssh/id_ed25519
debug1: Will attempt key: /home/pi/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /home/pi/.ssh/id_rsa
debug1: Trying private key: /home/pi/.ssh/id_dsa
debug1: Trying private key: /home/pi/.ssh/id_ecdsa
debug1: Trying private key: /home/pi/.ssh/id_ed25519
debug1: Trying private key: /home/pi/.ssh/id_xmss
debug1: Next authentication method: password
syncer@192.168.2.100's password: