この ssh コマンドはどういう意味ですか?

この ssh コマンドはどういう意味ですか?

これはポート転送について質問したときに得た回答ですが、それが何を意味するのかよく分かりません。

$ ssh lab_desktop -L 2200:lab_server:22 -vvv

私の推測ですが:

まず lab_desktop に接続し、次に再度 lab_server (ポート 22) にログインすると、この接続から受信したデータは lab_desktop、ポート 2200 に転送されます。

私の推測は正しいでしょうか?

しかし、私はまだ「-vvv」が何を意味するのか理解していません...


回答を適用した後に更新:

クリークの役に立つ回答とコメントに感謝します。私はクリークの回答を機能させるためにできる限りのことをしました。

もう一度、用語を明確にしておきます

mypc- 入力作業をしている人

lab_desktop- SSHサーバー

lab_server- 通信したい最終宛先。このサーバーは、 からの接続のみを許可しますlab_desktop。さらにもう 1 つ、ポート 122 経由の接続のみを許可します。

および へのログインにはlab_desktopユーザー名とパスワードが必要なので、常にパスワードを入力する手間を省き、パスワード入力によって ssh コマンドが複雑になる可能性を排除するために、 -- および--lab_serverに RSA 認証を作成しました。mypclab_desktoplab_desktoplab_server

その後、次のコマンドを使用しました:

ssh Black@lab_desktop -v -L 2200:lab_server:122

以下は出力です

chulhyun@chulhyun-Inspiron-3420:~/.ssh$ ssh Black@$labcom -v -L 2200:143.248.146.204:122 
OpenSSH_5.9p1 Debian-5ubuntu1.4, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 143.248.143.198 [143.248.143.198] port 22.
debug1: Connection established.
debug1: identity file /home/chulhyun/.ssh/id_rsa type -1
debug1: identity file /home/chulhyun/.ssh/id_rsa-cert type -1
debug1: identity file /home/chulhyun/.ssh/id_dsa type -1
debug1: identity file /home/chulhyun/.ssh/id_dsa-cert type -1
debug1: identity file /home/chulhyun/.ssh/id_ecdsa type -1
debug1: identity file /home/chulhyun/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1
debug1: match: OpenSSH_6.6.1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.4
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 79:64:5d:e7:ac:78:b7:52:3d:9a:6a:3b:c1:37:a0:2d
debug1: Host '143.248.143.198' is known and matches the ECDSA host key.
debug1: Found key in /home/chulhyun/.ssh/known_hosts:1
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,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Trying private key: /home/chulhyun/.ssh/id_rsa
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
Authenticated to 143.248.143.198 ([143.248.143.198]:22).
debug1: Local connections to LOCALHOST:2200 forwarded to remote address 143.248.146.204:122
debug1: Local forwarding listening on ::1 port 2200.
debug1: channel 0: new [port listener]
debug1: Local forwarding listening on 127.0.0.1 port 2200.
debug1: channel 1: new [port listener]
debug1: channel 2: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = ko_KR.UTF-8
Last login: Tue Jun 24 16:47:27 2014 from 143.248.244.12

Black@Black-PC ~
$

長いですが、私が注目すべきなのは、次の行だけだと思います。

debug1: Local connections to LOCALHOST:2200 forwarded to remote address 143.248.146.204:122
debug1: Local forwarding listening on ::1 port 2200.

netstat を使用してこれが true( netstat -tulpn | grep 2200) かどうかを確認すると、出力は次のようになります。

root@chulhyun-Inspiron-3420:/etc/ssh# netstat -tulpn | grep 2200
tcp        0      0 127.0.0.1:2200          0.0.0.0:*               LISTEN      14966/ssh       
tcp6       0      0 ::1:2200                :::*                    LISTEN      14966/ssh 

結局、SSH ホッピングが確立されたようです。

問題は、 でポート 2200 を使用しようとするときですmypc。 Creek が示唆したように、このポートを利用する必要があるため、ルート アカウントとユーザー アカウントの両方でログインしようとしましたが、結果はパスワードが原因で失敗しました。

chulhyun@chulhyun-Inspiron-3420:~$ su
password: 
root@chulhyun-Inspiron-3420:/home/chulhyun# ssh root@localhost -p 2200
root@localhost's password: 
Permission denied, please try again.
root@localhost's password: 

root@chulhyun-Inspiron-3420:/home/chulhyun# exit
exit
chulhyun@chulhyun-Inspiron-3420:~$ ssh chulhyun@localhost -p 2200
chulhyun@localhost's password: 
Permission denied, please try again.

パスワードは正しいと確信しています。しかし、なぜ機能しないのか理解できません...

ここまで来ました。さらに先に進むためにご協力いただけますか?


アップデート

私が直面している新たな問題は、以下で議論され解決されています。Linux は SSH 接続時に正しいパスワードを認識できませんか?

答え1

ssh lab_desktop -L 2200:lab_server:22 -vvv

  1. ssh lab_desktop- SSH接続を作成lab_desktopする$USER
  2. -L 2200:lab_server:22- への接続を使用してlab_desktop、ローカルマシンのポート2200をポート22に転送します。lab_server
  3. -vvv- 最大の詳細レベルを有効にする

このコマンドは、ローカル マシンのポート 2200 のソケットを開き、SSH トンネルを使用して、localhost のポート 2200 に送信されるすべてのトラフィックを lab_server のポート 22 に転送します。

転送されたポートを利用して lab_server への SSH 接続を確立するには、localhost のローカル ポートに接続する 2 番目の接続を開始する必要があります。

ssh user@localhost -p 2200

答え2

ssh -L 2200:lab_server:22 -vvv lab_desktop

次のことを行います:

最大レベル (3) で詳細出力され、debug level 3情報が出力されます。例:

debug3: channel 0: will not send data after close

を使用すると、自分の側の指定されたポートを経由して、オン ポートに-Lデータをトンネリングできます。2200lab_desktoplab_server22

lab_desktopしたがって、ポートに接続すると、ポート2200からデータが受信されます。lab_server22

SSHポートフォワーディングに関する良い情報源はここ

答え3

http://www.explainshell.com/explain?cmd=ssh+lab_desktop+-L+2200%3Alab_server%3A22+-vvv

ウェブサイトがダウンしている場合は、独自のバージョンを実行できます

https://github.com/idank/explainshell

ウェブサイトからの抜粋

ここに画像の説明を入力してください

関連情報