이 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. 그리고 한 가지 더: 포트 122를 통한 연결만 허용합니다.

좋습니다 . 로그인 lab_desktop하고 사용자 이름과 비밀번호 가 필요하기 때문에 항상 비밀번호를 입력해야 하는 문제에 직면하지 않고 비밀번호를 입력할 가능성을 제쳐두기 lab_server위해 RSA 인증을 만들었습니다 mypc. SSH 명령이 더 복잡해졌습니다.lab_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를 사용할 때( 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 호핑이 설정된 것 같아요 ..

이제 문제는 .NET에서 포트 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.

비밀번호는 정확하다고 확신합니다. 그런데 왜 안되는지 이해가 안가네요...

나는 이 지점에 이르렀다. 더 멀리 도달할 수 있도록 도와주실 수 있나요?


업데이트

내가 직면하고 있는 새로운 문제는 다음에서 논의되고 해결됩니다.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 터널을 사용하여 localhost의 포트 2200으로 전송된 모든 트래픽이 lab_server의 포트 22로 전달됩니다.

전달된 포트를 활용하고 lab_server에 대한 SSH 연결을 설정하려면 localhost의 로컬 포트에 연결하는 두 번째 연결을 시작해야 합니다.

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

웹사이트에서 추출

여기에 이미지 설명을 입력하세요

관련 정보