6
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SequelProでSSHトンネルが出来なかった

6
Posted at

環境

  • macOS El Capitan -> macOS High Sierra
  • Sequel Pro 1.1.2
  • キーチェーンアクセス 10.0

症状

macOS を El Capitan から High Sierra にアップグレードして、Sequel Pro で設定を保存してあるDB(SSHトンネル、鍵認証)に接続しようと思ったら、変なエラーが出て接続出来ない。
なじょして?!

Used command:  /usr/bin/ssh -v -N -S none -o ControlMaster=no -o ExitOnForwardFailure=yes -o ConnectTimeout=30 -o NumberOfPasswordPrompts=3 -i /Users/username/.ssh/id_rsa -o TCPKeepAlive=no -o ServerAliveInterval=60 -o ServerAliveCountMax=1 remote_username@xxx.xxx.xxx.xxx -L 49993:192.168.0.100:3306

OpenSSH_7.6p1, LibreSSL 2.6.2
debug1: Reading configuration data /Users/username/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Control socket " none" does not exist
debug1: Connecting to xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx] port 22.
debug1: fd 6 clearing O_NONBLOCK
debug1: Connection established.
key_load_public: invalid format
debug1: identity file /Users/username/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/username/.ssh/id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH_5* compat 0x0c000000
debug1: Authenticating to xxx.xxx.xxx.xxx:22 as 'remote_username'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: diffie-hellman-group-exchange-sha256
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: umac-64@openssh.com compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: umac-64@openssh.com compression: none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(2048<3072<8192) sent
debug1: got SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: got SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: ssh-rsa SHA256:1/IxmzE1R+BWG7216h40U8ww5P4e67xTIVwuuDNPOZo
debug1: Host 'xxx.xxx.xxx.xxx' is known and matches the RSA host key.
debug1: Found key in /Users/username/.ssh/known_hosts:3
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/username/.ssh/id_rsa
debug1: read_passphrase: can't open /dev/tty: Device not configured
debug1: permanently_drop_suid: 501
debug1: read_passphrase: can't open /dev/tty: Device not configured
debug1: permanently_drop_suid: 501
debug1: read_passphrase: can't open /dev/tty: Device not configured
debug1: permanently_drop_suid: 501
debug1: No more authentication methods to try.
remote_username@xxx.xxx.xxx.xxx: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

うーん、見るとどうやら鍵の認証でコケてるっぽい。

Used Command に載ってるコマンドをターミナルで叩くと、問題無く接続出来る。ローカルで、SSHトンネルに使うサーバにSSHでアクセスしても、問題なく接続出来ます。

なんでだ?
と思ってちょっと2H ほどハマってしまったんですが、全然大したことありませんでした。

原因と解決策

そもそも Sequel Pro は、秘密鍵のパスワードをキーチェーンアクセスに問い合わせに行きます。
なので、最初に Sequel Pro でキーチェーンアクセスへのアクセスを許可しますか、なポップアップが出てきます。
スクリーンショット 2018-08-08 11.34.15.png

んで、これで最初に適当に拒否をしてしまったのが原因。これで普通にPCにログインするパスワード(初期値)を入力して「常に許可」をクリックすれば、問題なくDBにアクセス出来ました。
要は、キーチェーンアクセスにアクセス出来ずにコケてた、と(・∀・)

これで通らない人は、キーチェーンアクセス内のパスワードを間違ってるとかでしょうかね。

こんなことに時間を費やすなんて…。
ていうか、せめてこれ毎回聞いてくれたら嬉しかったんだけどナー……。

6
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?