
./ssh/configファイルを使用してリバースSSHトンネルを設定するには?
このコマンドを再現しようとしています。
ssh -R 55555:localhost:22 user@host
私の.ssh / configファイルに入力すると、ssh host
ユーザーはリバーストンネルを介してホストにSSHとして接続されます。設定ファイルで許可されるコマンドは、コマンドラインフラグに対するより詳細な対応です。 sshのマニュアルページとssh_configのマニュアルページによると、その設定はBindAddressのようです。
私の.ssh/configファイルには次のものがあります。
Host host
Hostname host
User user
BindAddress 55555:localhost:22
これだけでなく、わずかな変更のために接続しようとすると接続が拒否されます。
ssh localhost -p 55555
ホストコンピュータにログインした後。初めてホストにsshingするときに上部に明示的にコマンドを発行すると、同じように機能します。私のプロファイルは、リバーストンネルコマンドなしで動作します。ssh host
ホストにユーザーとしてログインしました。
答え1
BindAddress
ご希望のオプションではありません。 ~からman ssh_config
:
BindAddress
Use the specified address on the local machine as the source
address of the connection. Only useful on systems with more than
one address.
その設定ファイルは-R
次のとおりですRemoteForward
。
RemoteForward
Specifies that a TCP port on the remote machine be forwarded over
the secure channel to the specified host and port from the local
machine. The first argument must be [bind_address:]port and the
second argument must be host:hostport. [...]
この情報を使用したコマンドライン
ssh -R 55555:localhost:22 user@host
次の.ssh/config
構文に変換されます。
Host host
HostName host
User user
RemoteForward 55555 localhost:22