くまきち

山と旅と家族が大事。
でも激しい物欲が理性と財布のタガを飛ばす
最近は自転車も乗ってる

freebsd-update したら ssh 接続できなくなった

2012-03-07 14:37:49 | SEまわり
FreeBSD 8.1R を使っていて、EoL が7月末だというので、9.0R にアップグレードしてみた。

アップグレード作業はすんなり終わったように見えたが、自前で導入している OpenSSL のライブラリや、libz の関係で、wget やら mysql が動かなかったけど、ライブラリをリビルドしたり、シンボリックリンクを張り替えて解決。

が、ssh でログインできなくなってしまった。
リモートからだけでなく、ローカルで試してもダメ。

デバッグフラグを立てて実行したらこんな感じ。

 
% ssh localhost -v
ssh localhost -v
OpenSSH_5.9p2, OpenSSL 1.0.0g 18 Jan 2012
debug1: Reading configuration data /usr/local/etc/ssh_config
debug1: Connecting to localhost [127.0.0.1] port 222
debug1: Connection established.
debug1: identity file /home/ooki/.ssh/id_rsa type -1
debug1: identity file /home/ooki/.ssh/id_rsa-cert type -1
debug1: identity file /home/ooki/.ssh/id_dsa type 2
debug1: identity file /home/ooki/.ssh/id_dsa-cert type -1
debug1: identity file /home/ooki/.ssh/id_ecdsa type -1
debug1: identity file /home/ooki/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9
debug1: match: OpenSSH_5.9 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9
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 9f:f8:1a:d9:61:59:b6:80:90:34:7a:5d:6f:9a:26:d5
debug1: Host '[localhost]:222' is known and matches the ECDSA host key.
debug1: Found key in /home/ooki/.ssh/known_hosts:3
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,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Trying private key: /home/ooki/.ssh/id_rsa
debug1: Offering DSA public key: /home/ooki/.ssh/id_dsa
debug1: Server accepts key: pkalg ssh-dss blen 433
debug1: key_parse_private_pem: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
Enter passphrase for key '/home/ooki/.ssh/id_dsa':
debug1: read PEM private key done: type DSA
debug1: Authentication succeeded (publickey).
Authenticated to localhost ([127.0.0.1]:222).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: channel 0: free: client-session, nchannels 1
Connection to localhost closed by remote host.
Connection to localhost closed.
Transferred: sent 3016, received 1888 bytes, in 0.1 seconds
Bytes per second: sent 53835.1, received 33700.5
debug1: Exit status -1


秘密鍵パスフレーズを入力し、auth ログにも、

 
Accepted publickey for ooki from 127.0.0.1 port 11651 ssh2


となっているのだが、直後に向こうからコネクションを切られる。

エラーメッセージで検索すると、認証完了後、そのユーザのホームディレクトリに移動(?)して、.csh などを走らせる時に問題がある、というのが多く見つかった。 ホームディレクトリの所有者が root になっているとか、そんなのも見つかった。

が、ホームディレクトリは所有したままだし、そもそも freebsd-update しただけでそれが変化しては困る。

幸い、リモートコンソールが使えるので、接続したままにしている ssh セッションの生き残りが切れてしまっても、操作する手段は残されているけど、なかなか解決策が見つからない。困った。

最新の画像もっと見る