ssh -t を使用するとジャンプホストを介して接続できますが、ssh -W は機能しません。

ssh -t を使用するとジャンプホストを介して接続できますが、ssh -W は機能しません。

私は制御できない方法でLocalClientコンピュータに接続しようとしています。私はすべての権限を持っています(管理者権限)RemoteHostJumpHostclientRemoteHost

SSH経由で完全に接続できますRemoteHostLocalClient

ssh -tX relayUserName@JumpHost remoteUser@RemoteHostIP

私の~/.ssh/configファイルの設定は次のとおりです。

Host RemoteHost
    ProxyCommand ssh -W %h:%p JumpHost

トンネリングしようとすると、RemoteHost次のエラーが発生します。

channel 0: open failed: administratively prohibited: open failed
stdio forwarding failed

以下を使用してssh -vより多くの情報を取得できます。

Authenticated to <JumpHost> ([JumpHostIP]:22).
debug1: channel_connect_stdio_fwd RemoteHostIP:22
debug1: channel 0: new [stdio-forward]
debug1: getpeername failed: Bad file descriptor
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: network
channel 0: open failed: administratively prohibited: open failed
stdio forwarding failed
ssh_exchange_identification: Connection closed by remote host

に基づいてこの回答sshd_config/etc/ssh/、in値を確認​​しRemoteHostて(手動で)設定しました。

AllowTcpForwarding yes

問題が引き続き発生し、他の方法を試すことはできません。

詳細:

  • OS:RemoteHostおよびLocalClient:Kubuntu 18.04 LTS
  • SSHバージョン(ssh -vを介して到達):RemoteHostLocalClientOpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017
  • SSHバージョン:(JumpHostssh -v debug1を介して到達):
debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH_5* compat 0x0c000000

参考までに、ブラウザを介してリモートで自分の実験にアクセスするには、実行RemoteHost中のJupyter Labインスタンスにトンネリングし、--no-browser --port=8889それをポート8888に転送する必要があります。LocalClientlocalhost:8888

ベストアンサー1

ProxyCommand ssh -W %h:%p JumpHostssh stdioと%h:%pの間のJumpHost(あなたの場合はRemoteHost)に転送を設定します。

AllowTcpForwarding yesこれは、設定を次に設定する必要があることを意味します。ジャンプホストsshd_configJumpHostだけがstdioからRemoteHostへの転送を実行するため、これは.not RemoteHostです。

JumpHostでsshd_configを変更できない場合は、次のことができます~/.ssh/config

Host RemoteHost
    ProxyCommand ssh JumpHost netcat %h %p

これはssh -Wと同じことを行いますが、デフォルトのコマンドを使用するため、JumpHostのsshサーバーはAllowTcpFowarding noを使用しても拒否しません。

JumpHostのnetcatプログラムを使用して、次のようにProxyCommandのssh stdioを別のホストにリダイレクトします。

interactive ssh <= stdio => ProxyCommand's ssh <= network => JumpHost's sshd <= stdio => netcat <= network => RemoteHost

SSH接続図

また見なさい:https://www.cyberciti.biz/faq/linux-unix-ssh-proxycommand-passing-through-one-host-gateway-server/

おすすめ記事