Watching a new world…

April 7th, 2007

Debugging SSH

Beim öffnen einer SSH-Verbindung zu einem Remoteserver, beispielsweise über scp, gibt es häufig mal Probleme, wel mal wieder irgendwas nicht stimmt. In den Logfiles ist über die Ursache in aller Regeln nicht viel zu finden. Hier ein Trick, um das ganze zu debuggen:

Über das Kommano

/usr/sbin/sshd -D -p8022 -dwird ein zweiter SSH-Deamon im Debugmodus gestartet (natürlich auf einem anderen Port, hier 8022).

Wird nun ein SSH-Connect auf den Server (natürlich über diesen alternativ-Port) durchgeführt, so teil dieser einem alle seine Sorgen direkt über die Console mit. Beispiel:

getnameinfo failed
Server listening on :: port 8022.
debug1: Bind to port 8022 on 0.0.0.0.
Bind to port 8022 on 0.0.0.0 failed: Address already in use.
Generating 768 bit RSA key.
RSA key generation complete.
debug1: Server will not fork when running in debugging mode.
debug1: rexec start in 4 out 4 newsock 4 pipe -1 sock 7
debug1: inetd sockets after dupping: 3, 3
Connection from 111.222.111.222 port 4810
debug1: Client protocol version 2.0; client software version JSCH-0.1.32
debug1: no match: JSCH-0.1.32
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-1.99-OpenSSH_4.1
debug1: permanently_set_uid: 71/65
debug1: list_hostkey_types: ssh-rsa,ssh-dss
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: client->server 3des-cbc hmac-md5 none
debug1: kex: server->client 3des-cbc hmac-md5 none
debug1: expecting SSH2_MSG_KEXDH_INIT
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: KEX done
debug1: userauth-request for user jboss service ssh-connection method none
debug1: attempt 0 failures 0
debug1: PAM: initializing for "jboss"
Failed none for jboss from 111.222.111.222 port 4810 ssh2
debug1: PAM: setting PAM_RHOST to "p57a0dc1b.dip.t-dialin.net"
debug1: PAM: setting PAM_TTY to "ssh"
debug1: userauth-request for user jboss service ssh-connection method publickey
debug1: attempt 1 failures 1
debug1: temporarily_use_uid: 1002/1000 (e=0/0)
debug1: trying public key file /data/jboss/.ssh/authorized_keys
Authentication refused: bad ownership or modes for file
/data/jboss/.ssh/authorized_keys

debug1: restore_uid: 0/0
debug1: temporarily_use_uid: 1002/1000 (e=0/0)
debug1: trying public key file /data/jboss/.ssh/authorized_keys2
debug1: restore_uid: 0/0
Failed publickey for jboss from 111.222.111.222 port 4810 ssh2
Received disconnect from 111.222.111.222: 3: com.jcraft.jsch.JSchException: Auth fail
debug1: do_cleanup
debug1: PAM: cleanup
debug1: do_cleanup
debug1: PAM: cleanup
Nach dem ersten Connection-Versuch wird der Prozess automatisch wieder beendet.

Hieraus ist z.B. zu lesen, dass die Berechtigungen für authorized_keys nicht korrekt sind. Na da wär ich doch sonst niemals drauf gerkommen…

No Responses to “Debugging SSH”

No comments yet

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

klipal online pharmacy buy online cialis viagra online xanax cream for women order zyban online oxazepam buy alternative erection lorazepam cheap drugs 2003 tramadol tramadol market sales tramadol rx pills diazepam discount retail alternative to valium at gnc online drugstore tenuate order order levitra discount cialis buy the cheapest propecia online cheapest generic viagra online drugstore order cialis soft tabs over internet need no doctor cheapest levitra prices woman viagra soft tabs natural substitutes for viagra soft tabs online viagra natural levitra substitutes female cialis alternative