schneerunzel
Goto Top

Authentifizierung mit SSH Key nicht möglich

Hallo ich habe ein Problem mit meinen SSH Keys.

auf meinem Backup Server (Backuppc) arbeite ich mit ssh Keys, diese füge ich mit ssh-copy-id root@client_ip_address ein.
Bei den meisten Server klappt das auch Einwandfrei nur leider bei einem nicht...

$ ssh-copy-id root@server03
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@server03's password:  

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@server03'"  
and check to make sure that only the key(s) you wanted were added.

$ ssh 'root@server03'  
root@server03's password:  

$

wodran kann das liegen?

ssh -v sieht so aus:
$ ssh -v root@server03
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to server03 [192.168.50.23] port 22.
debug1: Connection established.
debug1: identity file /var/lib/backuppc/.ssh/id_rsa type 1
debug1: identity file /var/lib/backuppc/.ssh/id_rsa-cert type -1
debug1: identity file /var/lib/backuppc/.ssh/id_dsa type -1
debug1: identity file /var/lib/backuppc/.ssh/id_dsa-cert type -1
debug1: identity file /var/lib/backuppc/.ssh/id_ecdsa type -1
debug1: identity file /var/lib/backuppc/.ssh/id_ecdsa-cert type -1
debug1: identity file /var/lib/backuppc/.ssh/id_ed25519 type -1
debug1: identity file /var/lib/backuppc/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.0p1 Debian-4+deb7u2
debug1: match: OpenSSH_6.0p1 Debian-4+deb7u2 pat OpenSSH* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 85:94:a4:40:7a:9d:ec:8c:3b:b3:92:89:44:69:fe:2b
debug1: Host 'server03' is known and matches the ECDSA host key.  
debug1: Found key in /var/lib/backuppc/.ssh/known_hosts:5
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /var/lib/backuppc/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /var/lib/backuppc/.ssh/id_dsa
debug1: Trying private key: /var/lib/backuppc/.ssh/id_ecdsa
debug1: Trying private key: /var/lib/backuppc/.ssh/id_ed25519
debug1: Next authentication method: password
root@server03's password:  

Hat jemand eine Idee

Content-Key: 258694

Url: https://administrator.de/contentid/258694

Printed on: April 20, 2024 at 02:04 o'clock

Mitglied: 114757
114757 Dec 30, 2014 updated at 12:37:21 (UTC)
Goto Top
Moin,
schon mal manuell auf dem Sever die authorized_keys gecheckt ob der Public Key des Users dort auch überhaupt angekommen ist ?
Hat die authorized_keys auf dem Server auch die richtigen Zugriffsrechte?
chmod 600 ~/.ssh/authorized_keys

Weiterhin könnten die Rechte des Ordners ~/.ssh falsch sein. Dieser sollte keine Schreibberechtigung für 'group' und 'other' haben. Um dies richtig zu stellen, muss folgender Befehl ausgeführt werden:

chmod go-w ~/.ssh

Gruß jodel32
Member: schneerunzel
schneerunzel Dec 30, 2014 at 12:52:36 (UTC)
Goto Top
Ist das so richtig?

root@backupserver:/var/lib/backuppc# ls -alh
insgesamt 32K
drwxr-x---  8 backuppc backuppc 4,0K Dez 30 11:27 .
drwxr-xr-x 44 root     root     4,0K Dez 10 17:56 ..
drwxr-x--- 18 backuppc backuppc 4,0K Dez 30 13:00 cpool
drwxr-x---  2 backuppc backuppc 4,0K Dez 30 13:00 log
drwxr-x--- 16 backuppc backuppc 4,0K Dez 29 17:26 pc
drwxr-x---  2 backuppc backuppc 4,0K Jan 15  2014 pool
drwx------  2 backuppc backuppc 4,0K Dez 30 11:49 .ssh
drwxr-x---  2 backuppc backuppc 4,0K Dez 30 11:41 trash
root@backupserver:/var/lib/backuppc# cd .ssh/
root@backupserver:/var/lib/backuppc/.ssh# ls
id_rsa  id_rsa.pub  known_hosts
root@backupserver:/var/lib/backuppc/.ssh# su backuppc
$ chmod go-w ~/.ssh
$ ssh root@server03
root@server03's password:  

und auf dem Server der gesichert werden soll sieht es so aus:
root@server03:~# cd .ssh/
root@server03:~/.ssh# ls -alh
insgesamt 28K
drwx------ 2 root root 4,0K Okt 27 07:55 .
drwxrwxrwx 4 root root 4,0K Dez 27 09:49 ..
-rw------- 1 root root 5,9K Dez 30 11:49 authorized_keys
-rw------- 1 root root 1,7K Okt 27 07:55 id_rsa
-rw-r--r-- 1 root root  414 Okt 27 07:55 id_rsa.pub
-rw-r--r-- 1 root root 2,4K Dez 20 14:49 known_hosts
root@server03:~/.ssh# chmod go-w ~/.ssh

funktioniert leider noch immer nicht
Member: Gersen
Solution Gersen Dec 30, 2014, updated at Jan 03, 2015 at 11:13:42 (UTC)
Goto Top
Hallo,

es sieht so aus, als könne der Server mit einem RSA-Key nix anfangen (im Log steht auch sehr viel von ECDSA von Seiten des Servers) oder akzeptiert ihn (speziell oder RSA generell) nicht.

Im Idealfall (RSA-RSA) sollten die Zeilen 37/38 in Deinem Log so aussehen:
debug1: Offering RSA public key: /irgendwo/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Wie schauen denn die entsprechenden Stellen (auth.log) auf Seiten des Servers aus? Evtl. prüfen, ob in der sshd_config des Servers RSA-Authentifikation vielleicht verboten ist (Parameter: RSAAuthentication; siehe hier). Vielleicht auch mal hier schauen.

Gruß,
Gersen