SSH는 로그인 후 연결을 닫습니다. 종료 상태 254

SSH는 로그인 후 연결을 닫습니다. 종료 상태 254

나는 여기에 나와 관련된 모든 문제를 모두 읽었지만 그들 모두가 어떻게든 서버 파일에 액세스할 수 있는 것 같다는 점을 언급하는 것부터 시작해야 합니다. 그렇지 않습니다. 그래서 여기에 제 질문이 있습니다.

나는 centOS 6.5를 사용하고 있으며 로그인 성공 직후 ssh가 연결을 닫습니다. 나는 Mac과 Windows/Putty를 사용하여 동일한 결과로 내 서버에 액세스하고 있습니다. 어쨌든 이제 파일에 액세스하지 않고도 내 서버에 액세스할 수 있나요?

다음은 성공적인 로그인 직후 ssh -vvv에서 읽은 내용입니다.

debug1: Authentication succeeded (password).
Authenticated to 4X.5X.XX.2 ([4X.5X.XX.2]:82).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug2: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: ssh_packet_set_tos: set IP_TOS 0x10
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug1: Sending environment.
debug3: Ignored env TERM_PROGRAM
debug3: Ignored env SHELL
debug3: Ignored env TERM
debug3: Ignored env TMPDIR
debug3: Ignored env Apple_PubSub_Socket_Render
debug3: Ignored env TERM_PROGRAM_VERSION
debug3: Ignored env TERM_SESSION_ID
debug3: Ignored env USER
debug3: Ignored env SSH_AUTH_SOCK
debug3: Ignored env __CF_USER_TEXT_ENCODING
debug3: Ignored env PATH
debug3: Ignored env PWD
debug1: Sending env LANG = en_US.UTF-8
debug2: channel 0: request env confirm 0
debug3: Ignored env XPC_FLAGS
debug3: Ignored env XPC_SERVICE_NAME
debug3: Ignored env SHLVL
debug3: Ignored env HOME
debug3: Ignored env LOGNAME
debug3: Ignored env _
debug2: channel 0: request shell confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel_input_status_confirm: type 99 id 0
debug2: PTY allocation request accepted on channel 0
debug2: channel 0: rcvd adjust 2097152
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0
Last login: Wed Oct  7 06:23:21 2015 from 1XX.XXX.X1.185
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
debug2: channel 0: rcvd eow
debug2: channel 0: close_read
debug2: channel 0: input open -> closed
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: channel 0: close_write
debug2: channel 0: output drain -> closed
debug2: channel 0: rcvd close
debug3: channel 0: will not send data after close
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
  #0 client-session (t4 r0 i3/0 o3/0 fd -1/-1 cc -1)

Connection to 4X.5X.XX.2 closed.
Transferred: sent 3176, received 2640 bytes, in 0.3 seconds
Bytes per second: sent 10370.6, received 8620.4
debug1: Exit status 254

답변1

기록상 이것은 확실히 사용자 셸을 포크하는 문제였습니다. 이는 다음으로 인해 발생할 수 있습니다.

  1. 쉘 초기화 파일의 문제
  2. 메모리 부족 상태
  3. 프로세스 중단 상태

이것은 매우 늦은 답변이지만 이 상황에서는 명령을 직접 실행하려고 시도했을 것입니다. 예를 들어 ssh server ls -ltra일부 쉘 초기화를 우회하고 다른 쉘 초기화 파일을 사용하는 다른 사용자로 로그인한 다음 재부팅할 수 있습니다. 리소스 부족 상태를 해결해야 합니다.

답변2

커널 매개변수 파일 /etc/security/limits.conf의 열린 파일 구성을 무제한으로 변경하여 연결이 끊어졌습니다.

루트 사용자의 정상으로 되돌린 후 다시 연결되었습니다.

Wrong Example:
## Example hard limit for max opened files
*        hard   nofile unlimited
root     hard   nofile  unlimited
## Example soft limit for max opened files
*        soft   nofile unlimited
root     soft   nofile unlimited

Correct Ex:
## Example hard limit for max opened files
*        hard   nofile 16000
root     hard   nofile 16000
## Example soft limit for max opened files
*        soft   nofile 16000
root     soft   nofile 16000

관련 정보