SSH 연결을 종료하려면 어떻게합니까? 서버에 연결하여 다음과 같은 명령을

SSH를 통해 서버에 연결하여 다음과 같은 명령을 사용하여 소켓 서버에 메시지를 보냅니다.

ssh 181.169.1.2 -p 5566

연결이 완료된 후 메시지를 작성하여 보내면 텍스트 모드를 종료 할 수 없습니다. 더 많은 텍스트를 입력 할 수 있습니다.

명령 모드로 돌아갈 수있는 명령 또는 키 조합이 있습니까?



답변

SSH 연결을 종료하려면 어떻게합니까?

두 가지 방법:

  • 로 예 쉘 세션 종료 exit다음을 Enter, 또는 Ctrld일반적으로 당신이 종료 할 수 있습니다 ssh, 일반적으로 세션을
  • 연결 상태가 좋지 않고 셸이 응답하지 않는 경우 Enter키를 누른 다음 type ~.and ssh를 즉시 닫고 명령 프롬프트로 돌아갑니다.

첫 번째 옵션은 직관적이어야하지만 후자의 옵션은 어떻게 알 수 있습니까?

맨 페이지를주의 깊게 읽음으로써이 정보를 배울 수 있습니다.

$ man ssh

이스케이프 문자에 대한 다음 섹션이 있는 SSH 문서를 제공 합니다.

ESCAPE CHARACTERS
     When a pseudo-terminal has been requested, ssh supports a number of
     functions through the use of an escape character.

     A single tilde character can be sent as ~~ or by following the tilde by
     a character other than those described below.  The escape character
     must always follow a newline to be interpreted as special.  The escape
     character can be changed in configuration files using the EscapeChar
     configuration directive or on the command line by the -e option.

     The supported escapes (assuming the default ‘~’) are:

     ~.      Disconnect.

     ~^Z     Background ssh.

     ~#      List forwarded connections.

     ~&      Background ssh at logout when waiting for forwarded connection
             / X11 sessions to terminate.

     ~?      Display a list of escape characters.

     ~B      Send a BREAK to the remote system (only useful if the peer sup‐
             ports it).

     ~C      Open command line.  Currently this allows the addition of port
             forwardings using the -L, -R and -D options (see above).  It
             also allows the cancellation of existing port-forwardings with
             -KL[bind_address:]port for local, -KR[bind_address:]port for
             remote and -KD[bind_address:]port for dynamic port-forwardings.
             !command allows the user to execute a local command if the
             PermitLocalCommand option is enabled in ssh_config(5).  Basic
             help is available, using the -h option.

     ~R      Request rekeying of the connection (only useful if the peer
             supports it).

     ~V      Decrease the verbosity (LogLevel) when errors are being written
             to stderr.

     ~v      Increase the verbosity (LogLevel) when errors are being written
             to stderr.

답변

짧은 답변 : 유형 exit

그래도 작동하지 않으면 …

SSH 이스케이프 문자 및 연결 끊기 순서

대부분의 SSH 구현은 텔넷 Ctrl-]조합 과 유사한 대화식 세션의 이스케이프 문자를 구현합니다 . 기본 SSH 이스케이프 문자는 ~행의 시작 부분에 입력됩니다.

원격 측 쉘에 들어가 exit거나 CtrlD들어가서 정지되어 종료 될 수없는 대화식 OpenSSH 세션을 종료하려면 ~점을 입력하십시오 .. 입력 줄의 시작 부분에 이스케이프 문자를 입력하려면 Enter 키를 먼저 눌러야합니다. 따라서 다음 순서는 대부분 SSH 세션을 종료합니다.

Enter~.

다른 탈출 순서

예를 들어 OpenSSH는 이외의 다른 이스케이프 시퀀스를 제공합니다 ~.. ~?세션 중에 들어가면 목록이 나타납니다. 몇 가지 예 :

  • ~따라 Ctrl-Z세션을 일시 중단
  • ~& 직접 배경에 넣습니다.
  • ~# 이 세션에서 전달 된 연결 목록을 제공합니다.
  • 줄의 시작 부분에 물결표를 입력하려면 두 번 입력해야합니다 ~~.

이스케이프 문자는 명령 행 옵션을 사용하여 변경할 수 있습니다 -e. 특수 값을 설정하면 -e none이스케이프가 비활성화되고 세션이 완전히 투명 해집니다.

명령 행 옵션 아래 ssh ( www.openssh.org 에서 참조 ) 의 OpenBSD 매뉴얼 페이지 도 참조하십시오.-e


답변

SSH 쉘을 종료 하시겠습니까?

를 입력 exit하고을 누르 Enter거나 Ctrl+를 사용할 수 있습니다D


답변

그냥 입력 exit하거나 logout(물론 Enter 키를 누르십시오) 둘 다 작동합니다.


답변

ssh로 놀 수있는 다양한 옵션을 제공하는 지원되는 문자입니다.

지원되는 이스케이프 시퀀스 :

 ~.  - terminate session

 ~B  - send a BREAK to the remote system

 ~R  - Request rekey (SSH protocol 2 only)

 ~#  - list forwarded connections

 ~?  - this message

 ~~  - send the escape character by typing it twice

이스케이프는 개행 직후에만 인식됩니다.을 눌러 이스케이프 시퀀스 목록을 닫을 수 있습니다 Enter.


답변

logout콘솔 라인에 쓸 수 있습니다 ( Enter물론 맞습니다).


답변

MacOS : ssh가 멈 추면 다음 순서를 사용하십시오.

ENTER
SHIFT+`
.

여기서 : shift +`~ (물결 문자)를 생성합니다.