sshdのデバッグモード
sshをつかってて、たまになんでかわからないけどつながらないことがあります。
bash-2.05$ /usr/local/bin/ssh hoge@hogehoge ls Permission denied (publickey,keyboard-interactive).
クライアント側のid_rsaと、サーバ側のauthorized_keysのペアも正しいし、何でだろう。ssh -v でログをだしてみても良くわからない。
bash-2.05$ /usr/local/bin/ssh -v hoge@hogehoge ls OpenSSH_4.4p1, OpenSSL 0.9.8d 28 Sep 2006 debug1: Reading configuration data /usr/local/etc/ssh_config debug1: Connecting to hogehoge [192.168.10.1] port 22. debug1: Connection established. debug1: identity file /home1/hoge/.ssh/identity type -1 debug1: identity file /home1/hoge/.ssh/id_rsa type 1 debug1: identity file /home1/hoge/.ssh/id_dsa type -1 debug1: Remote protocol version 1.99, remote software version OpenSSH_4.4 debug1: match: OpenSSH_4.4 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_4.4 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-cbc hmac-md5 none debug1: kex: client->server aes128-cbc hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Host 'hogehoge' is known and matches the RSA host key. debug1: Found key in /home1/hoge/.ssh/known_hosts:9 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,keyboard-interactive debug1: Next authentication method: publickey debug1: Trying private key: /home1/hoge/.ssh/identity debug1: Offering public key: /home1/hoge/.ssh/id_rsa debug1: Authentications that can continue: publickey,keyboard-interactive debug1: Trying private key: /home1/hoge/.ssh/id_dsa debug1: Next authentication method: keyboard-interactive debug1: Authentications that can continue: publickey,keyboard-interactive debug1: No more authentication methods to try. Permission denied (publickey,keyboard-interactive).
サーバ側でsshdをデバッグモードで動作させると一発で原因がわかりました。
bash-2.05# /usr/local/sbin/sshd -d debug1: sshd version OpenSSH_4.4p1 debug1: private host key: #0 type 0 RSA1 debug1: read PEM private key done: type RSA debug1: private host key: #1 type 1 RSA debug1: read PEM private key done: type DSA debug1: private host key: #2 type 2 DSA debug1: rexec_argv[0]='/usr/local/sbin/sshd' debug1: rexec_argv[1]='-d' debug1: Bind to port 22 on ::. Server listening on :: port 22. debug1: Bind to port 22 on 0.0.0.0. Server listening on 0.0.0.0 port 22. Generating 768 bit RSA key. RSA key generation complete. (ここでクライアントから接続要求を出す。) (中略) Authentication refused: bad ownership or modes for directory /export/home/hoge debug1: restore_uid: 0/1 (後略)
あー、ディレクトリのパーミションがまずいってことか。
47/100
- 作者: エドモンド・ハミルトン,中村融
- 出版社/メーカー: 河出書房新社
- 発売日: 2004/04/15
- メディア: 単行本
- クリック: 48回
- この商品を含むブログ (78件) を見る
以前に読んだ 神は沈黙せず に出てくるこのタイトル。人造宇宙というのが気になって読んでみました。このタイトルだけじゃなくて、夢と現実の区別がつかなくなる、死者が生き返って絶望するなどなど。