[Solved] ssh key

Alle weiteren Dienste, die nicht in die drei oberen Foren gehören.
Antworten
Benutzeravatar
zwarag
Beiträge: 17
Registriert: 03.02.2012 10:24:44

[Solved] ssh key

Beitrag von zwarag » 05.04.2012 14:03:00

Hallo, ich versuche gerade von Server a nach b zu kommen und würde gerne mit a ein backup von b machen.
Dafür wäre es mir ganz lieb wenn ich nicht jedes mal ein Passwort eingeben müsste oder gar in den scripts es in plain-text speichern muss.
Darüber hinaus möchte ich es auch für alle meine SSH verbindungen nutzen.

Ich habs nun schon sicher 15x versucht, immer ein bisschen anderst, immer auf die rechte geachtet aber es will einfach nicht... weil ichs falsch einstelle is mir schon klar^^
verbunden wird von einem ubuntu 11.10 nach einem debian squeeze, beide mit open ssh
ubuntu hat OpenSSH_5.8p1 Debian-7ubuntu1, OpenSSL 1.0.0e 6 Sep 2011
debian OpenSSH_5.5p1 Debian-6+squeeze1, OpenSSL 0.9.8o 01 Jun 2010

Code: Alles auswählen

www-data@backup:~$ ssh sh_backup@edis -p222 -vvv
OpenSSH_5.8p1 Debian-7ubuntu1, OpenSSL 1.0.0e 6 Sep 2011
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to edis [xx.xxx.xx.xx] port 222.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "/var/work/www/.ssh/id_rsa" as a RSA1 public key
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: missing keytype
debug1: identity file /var/work/www/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /var/work/www/.ssh/id_rsa-cert type -1
debug1: identity file /var/work/www/.ssh/id_dsa type -1
debug1: identity file /var/work/www/.ssh/id_dsa-cert type -1
debug1: identity file /var/work/www/.ssh/id_ecdsa type -1
debug1: identity file /var/work/www/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.5p1 Debian-6+squeeze1
debug1: match: OpenSSH_5.5p1 Debian-6+squeeze1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.8p1 Debian-7ubuntu1
debug2: fd 3 setting O_NONBLOCK
debug3: put_host_port: [edis]:222
debug3: load_hostkeys: loading entries for host "[edis]:222" from file "/var/work/www/.ssh/known_hosts"
debug3: load_hostkeys: found key type RSA in file /var/work/www/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys
debug3: order_hostkeyalgs: prefer hostkeyalgs: ssh-rsa-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-rsa
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-rsa,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-dss-cert-v00@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_setup: found hmac-md5
debug1: kex: server->client aes128-ctr hmac-md5 none
debug2: mac_setup: found hmac-md5
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug2: dh_gen_key: priv key bits set: 130/256
debug2: bits set: 515/1024
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 50:b3:ed:26:cb:ec:9b:55:16:1a:ac:70:48:64:89:05
debug3: put_host_port: [xx.xxx.xx.xx]:222
debug3: put_host_port: [edis]:222
debug3: load_hostkeys: loading entries for host "[edis]:222" from file "/var/work/www/.ssh/known_hosts"
debug3: load_hostkeys: found key type RSA in file /var/work/www/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys
debug3: load_hostkeys: loading entries for host "[xx.xxx.xx.xx]:222" from file "/var/work/www/.ssh/known_hosts"
debug3: load_hostkeys: found key type RSA in file /var/work/www/.ssh/known_hosts:2
debug3: load_hostkeys: loaded 1 keys
debug1: Host '[edis]:222' is known and matches the RSA host key.
debug1: Found key in /var/work/www/.ssh/known_hosts:1
debug2: bits set: 491/1024
debug1: ssh_rsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /var/work/www/.ssh/id_rsa (0x7fa17bfd73b0)
debug2: key: /var/work/www/.ssh/id_dsa ((nil))
debug2: key: /var/work/www/.ssh/id_ecdsa ((nil))
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /var/work/www/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /var/work/www/.ssh/id_dsa
debug3: no such identity: /var/work/www/.ssh/id_dsa
debug1: Trying private key: /var/work/www/.ssh/id_ecdsa
debug3: no such identity: /var/work/www/.ssh/id_ecdsa
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
sh_backup@edis's password:
Kann mir jemand erklären wo ich anfahre?
Zuletzt geändert von zwarag am 05.04.2012 15:19:09, insgesamt 1-mal geändert.

Benutzeravatar
whisper
Beiträge: 3388
Registriert: 23.09.2002 14:32:21
Lizenz eigener Beiträge: GNU Free Documentation License
Kontaktdaten:

Re: ssh key

Beitrag von whisper » 05.04.2012 14:13:46

Ja, wo hastdu denn den Key her?

dieses

Code: Alles auswählen

 unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug3: key_read: missing whitespace
sollte dir zu denken geben.
In die authorized_keys gehört der id_rsa.pub oder dss.... wenn du mit ssh-keygen den schlüssel generierst, liegt er in .ssh
Alter ist übrigens keine Ausrede, nur Erfahrung, die sich stapelt. 😉

Benutzeravatar
zwarag
Beiträge: 17
Registriert: 03.02.2012 10:24:44

Re: ssh key

Beitrag von zwarag » 05.04.2012 15:18:49

key generiert aus ssk-keygen und rüberkopiert
aber hat sich erledigt
hab in der /etc/ssh/sshd_config

die zeile
AuthorizedKeysFile ~/.ssh/authorized_keys
in
AuthorizedKeysFile /home/%u/.ssh/authorized_keys
umgeändert und ging dann plötzlich, warum auch immer wird mir ein Geheimniss bleiben ^^
oder kann mir das jemand Erklären?

nepos
Beiträge: 5238
Registriert: 05.01.2005 10:08:12

Re: [Solved] ssh key

Beitrag von nepos » 06.04.2012 10:10:29

Weil die erste Variante beim Starten des sshd die ~ expandiert und dabei das Home-Verzeichnis des Users rauskommt, der den sshd startet. Die zweite Variante ist die richtige, denn die setzt den Usernamen in den Pfad ein und damit nimmt der sshd die authorized_keys des Users, der sich anmelden will.

Antworten