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

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

ポートフォワーディングに関する質問に対する答えですが、どういう意味なのかよくわかりません。

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

私の推測:

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

私の推測は正しいですか?

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


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

Xiaoxiの有用な答えとコメントに同意します。 Xiaoxiの答えがうまくいくように最善を尽くしました。

もう一度言葉を明確にします。

mypc- すべてのタイピングを担当する人

lab_desktop- SSHサーバー

lab_server- コミュニケーションの最終目的地が欲しい。このサーバーはからの接続のみを許可しますlab_desktop。もう1つ:ポート122を介した接続のみを許可します。

さて、ログインし、lab_desktopユーザー名とパスワードをlab_server要求して以来、rsa認証を実行しましたmypclab_desktop そのため、常にパスワードを入力する手間に直面する必要がなく、パスワードを入力する可能性も排除しました。したがって、sshコマンドはより複雑です。lab_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を使用すると、(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ジャンプはすでに確立されていると思います..

これでログインしようとすると問題が発生しますmypc。 Creekが提案したようにこのポートを利用する必要があるため、rootアカウントとユーザーアカウントを使用してログインしようとしましたが、パスワードのため失敗しました。

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.

パスワードが正しいと思います。しかし、なぜできないのかわかりません...

私はこのポイントに達した。私たちがさらに進むのを手伝ってくれますか?


修正する

私が直面する新しい問題は、以下で議論され解決されます。SSHを使用すると、Linuxは正しいパスワードを認識しませんか?

ベストアンサー1

ssh lab_desktop -L 2200:lab_server:22 -vvv

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

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

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

ssh user@localhost -p 2200

おすすめ記事