質問: macintosh osx el capitanでsshトンネリングを機能させる方法は? yosemiteからelcapitanにアップグレードしましたが、sshトンネリングが壊れているようです。アップグレードする前に、アプリを使用して別のコンピューターからvncセッションをトンネリングすることができましたssh tunnel managerですが、アップグレード後、再接続のループに入ります。シェルからの手動コマンドも試しました。ssh -p 22 -r 5917:host-centos5x32:5917 user@router.example.com sshは接続しますが、real vnc v5.0.4はダイアログのエラーでvncディスプレイ17にディスプレイを表示できません(選択のみがokです):vnc viewer connect: connection refused (61) ヨセミテでは両方のトンネリング方法が正常に機能しましたが、elcapitanでは常に失敗します。sshのレベル3の冗長性は次のとおりです。bash-3.2$ ssh -vvv -p 22 -r 5917:h3-centos4x32:5917 user@router.example.com openssh_6.9p1, libressl 2.1.7 debug1: reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 20: applying options for * debug1: /etc/ssh/ssh_config line 102: applying options for * debug2: ssh_connect: needpriv 0 debug1: connecting to router.example.com [10.1.10.20] port 22. debug1: connection established. debug1: key_load_public: no such file or directory debug1: identity file /users/user/.ssh/id_rsa type -1 debug1: key_load_public: no such file or directory debug1: identity file /users/user/.ssh/id_rsa-cert type -1 debug1: key_load_public: no such file or directory debug1: identity file /users/user/.ssh/id_dsa type -1 debug1: key_load_public: no such file or directory debug1: identity file /users/user/.ssh/id_dsa-cert type -1 debug1: key_load_public: no such file or directory debug1: identity file /users/user/.ssh/id_ecdsa type -1 debug1: key_load_public: no such file or directory debug1: identity file /users/user/.ssh/id_ecdsa-cert type -1 debug1: key_load_public: no such file or directory debug1: identity file /users/user/.ssh/id_ed25519 type -1 debug1: key_load_public: no such file or directory debug1: identity file /users/user/.ssh/id_ed25519-cert type -1 debug1: enabling compatibility mode for protocol 2.0 debug1: local version string ssh-2.0-openssh_6.9 debug1: remote protocol version 2.0, remote software version openssh_4.3 debug1: match: openssh_4.3 pat openssh_4* compat 0x00000000 debug2: fd 3 setting o_nonblock debug1: authenticating to router.example.com:22 as 'user' debug3: put_host_port: [router.example.com]:22 debug3: hostkeys_foreach: reading file "/users/user/.ssh/known_hosts" debug3: record_hostkey: found key type rsa in file /users/user/.ssh/known_hosts:14 debug3: load_hostkeys: loaded 1 keys from [router.example.com]:22 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: curve25519-sha256@libssh.org,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-ed25519-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-ed25519,ssh-dss debug2: kex_parse_kexinit: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se debug2: kex_parse_kexinit: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se debug2: kex_parse_kexinit: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1,hmac-md5-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96 debug2: kex_parse_kexinit: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1,hmac-md5-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,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-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,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96 debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,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 debug1: kex: server->client aes128-ctr hmac-sha1 none debug1: kex: client->server aes128-ctr hmac-sha1 none debug1: ssh2_msg_kex_dh_gex_request(1024<7680<8192) sent debug1: got ssh2_msg_kex_dh_gex_group debug2: bits set: 3081/6144 debug1: ssh2_msg_kex_dh_gex_init sent debug1: got ssh2_msg_kex_dh_gex_reply debug1: server host key: ssh-rsa sha256:7tdkxsi5vgivhcasm9u+a/s+pmz+u+s2vwma55t8y6w debug3: put_host_port: [10.1.10.20]:22 debug3: put_host_port: [router.example.com]:22 debug3: hostkeys_foreach: reading file "/users/user/.ssh/known_hosts" debug3: record_hostkey: found key type rsa in file /users/user/.ssh/known_hosts:14 debug3: load_hostkeys: loaded 1 keys from [router.example.com]:22 debug3: hostkeys_foreach: reading file "/users/user/.ssh/known_hosts" debug3: record_hostkey: found key type rsa in file /users/user/.ssh/known_hosts:14 debug3: load_hostkeys: loaded 1 keys from [10.1.10.20]:22 debug1: host '[router.example.com]:22' is known and matches the rsa host key. debug1: found key in /users/user/.ssh/known_hosts:14 debug2: bits set: 3090/6144 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: /users/user/.ssh/id_rsa (0x0), debug2: key: /users/user/.ssh/id_dsa (0x0), debug2: key: /users/user/.ssh/id_ecdsa (0x0), debug2: key: /users/user/.ssh/id_ed25519 (0x0), debug1: authentications that can continue: publickey,gssapi-with-mic,password debug3: start over, passed a different list publickey,gssapi-with-mic,password debug3: preferred 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: trying private key: /users/user/.ssh/id_rsa debug3: sign_and_send_pubkey: rsa sha256:a+3ac5+lszvvqgrjkcymig35szhos9kkpv+yy2t6t2o debug2: we sent a publickey packet, wait for reply debug1: authentication succeeded (publickey). authenticated to router.example.com ([10.1.10.20]:22). debug1: remote connections from localhost:5917 forwarded to local address h3-centos4x32:5917 debug1: channel 0: new [client-session] debug3: ssh_session2_open: channel_new: 0 debug2: channel 0: send open debug1: entering interactive session. debug1: remote forward success for: listen 5917, connect h3-centos4x32:5917 debug1: all remote forwarding requests processed debug2: callback start debug2: fd 3 setting tcp_nodelay debug3: ssh_packet_set_tos: set ip_tos 0x10 debug2: client_session2_setup: id 0 debug2: channel 0: request pty-req confirm 1 debug1: sending environment. debug3: ignored env shell debug3: ignored env term debug3: ignored env tmpdir debug3: ignored env apple_pubsub_socket_render debug3: ignored env emacsdata debug3: ignored env emacspath debug3: ignored env user debug3: ignored env emacs debug3: ignored env ssh_auth_sock debug3: ignored env termcap debug3: ignored env __cf_user_text_encoding debug3: ignored env columns debug3: ignored env path debug3: ignored env pwd debug3: ignored env xpc_flags debug3: ignored env xpc_service_name debug3: ignored env emacsloadpath debug3: ignored env shlvl debug3: ignored env home debug3: ignored env logname debug3: ignored env infopath debug3: ignored env display debug3: ignored env inside_emacs debug3: ignored env emacsdoc debug3: ignored env _ debug2: channel 0: request shell confirm 1 debug2: callback done debug2: channel 0: open confirm rwindow 0 rmax 32768 debug2: channel_input_status_confirm: type 99 id 0 debug2: pty allocation request accepted on channel 0 debug2: channel 0: rcvd adjust 2097152 debug2: channel_input_status_confirm: type 99 id 0 debug2: shell request accepted on channel 0 回避策として、macintosh osx elcapitanでoraclevirtualbox vm)を実行しているwindows 10内でvncを接続し、puttyでトンネリングできることに注意してください。sshの代替実装も試しました。 macintoshで同じ問題が発生しました。更新:macは次の警告を表示しますが、mac内のwindows vmはsshとトンネリングを適切に続行します: 警告:リッスンポート5917のリモートポート転送に失敗しました
回答: まず、私が理解しているように、ユースケースを要約します。エッジデバイス(router.example.com)にsshし、クライアント(開始しているホスト)からvncに接続できるsshトンネルを介して転送ルールを設定します。 ssh from)からhost-centos5x32:5917へ。vncサーバーがリッスンしています。設定したのは、sshサーバー(router.example.com)からターゲットホスト(host-centos5x32)に転送するルールです。代わりに、次のsshコマンドを使用します。ssh-l5917:host-centos5x32:5917 user@router.example.comこれがデフォルトであるため、-p 22を削除し、-rルール(宛先でリッスンし、指定どおりに転送)を-lルール(ローカルホストでリッスンし、指定どおりに転送)に変更しました。これがアクティブな場合、ローカルホスト:5917(またはローカルホストディスプレイ18)にvncでき、期待どおりにルーティングされます。 'telnet localhost:5917'または 'nc localhost 5917'を使用してこれを診断する方が簡単な場合があり、vncは「rfb003.008」のような応答を返します。