SSH автоматически выходит из системы

SSH автоматически выходит из системы

Я запускаю команду ssh user@hostи автоматически выхожу из системы.

Вот результат добавления флагов -vvv:

debug3: send packet: type 50
debug2: we sent a password packet, wait for reply
debug3: receive packet: type 52
debug1: Authentication succeeded (password).
Authenticated to [host] ([IPADDR]:PORT).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting [email protected]
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: network
debug3: receive packet: type 91
debug2: callback start
debug2: fd 4 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
debug3: send packet: type 98
debug1: Sending environment.
debug3: Ignored env XDG_SESSION_ID
debug3: Ignored env HOSTNAME
debug3: Ignored env TERM
debug3: Ignored env SHELL
debug3: Ignored env HISTSIZE
debug3: Ignored env IGNOREEOF
debug3: Ignored env SSH_CLIENT
debug3: Ignored env SSH_TTY
debug3: Ignored env QT_GRAPHICSSYSTEM_CHECKED
debug3: Ignored env USER
debug3: Ignored env LS_COLORS
debug3: Ignored env MAIL
debug3: Ignored env PATH
debug3: Ignored env PWD
debug1: Sending env LANG = en_US.UTF-8
debug2: channel 0: request env confirm 0
debug3: send packet: type 98
debug3: Ignored env KDEDIRS
debug3: Ignored env HISTCONTROL
debug3: Ignored env SHLVL
debug3: Ignored env HOME
debug3: Ignored env LOGNAME
debug3: Ignored env XDG_DATA_DIRS
debug3: Ignored env SSH_CONNECTION
debug3: Ignored env LESSOPEN
debug3: Ignored env XDG_RUNTIME_DIR
debug3: Ignored env QT_PLUGIN_PATH
debug3: Ignored env _
debug2: channel 0: request shell confirm 1
debug3: send packet: type 98
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: PTY allocation request accepted on channel 0
debug2: channel 0: rcvd adjust 2097152
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0
You have mail.
Last login: Sat Jul 18 21:42:05 2020 from [IPADDR2]
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug3: receive packet: type 98
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
debug3: receive packet: type 96
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
debug3: receive packet: type 97
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
debug3: send packet: type 97
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)

debug3: send packet: type 1
Connection to [host] closed.
Transferred: sent 2328, received 2512 bytes, in 0.0 seconds
Bytes per second: sent 222371.7, received 239947.4
debug1: Exit status 1

Любая помощь в устранении этой проблемы будет очень признательна!

решение1

Согласно отладочному выводу, sshаутентификация прошла успешно. Затем он установил интерактивный сеанс оболочки на удаленной системе. Есть какой-то текст, который, по-видимому, является типичным приветственным сообщением от удаленной системы, затем сеанс немедленно завершается с кодом выхода 1.

Другими словами, ssh создал удаленный сеанс, но он тут же закрылся. Есть несколько вещей, которые могут вызвать это, и по отладочной трассировке невозможно сказать, в чем проблема:

  • В файлах запуска удаленной оболочки (.bashrc и т. д.) может быть что-то, что приводит к немедленному завершению работы оболочки.
  • Возможно, что-то не так с удаленной оболочкой (/bin/bash или любой другой), что не позволяет запустить программу.
  • Ваша учетная запись может быть отключена или настроена таким образом, чтобы не допускать интерактивных сеансов.
  • На удаленном хосте могут быть другие проблемы, мешающие запустить процесс оболочки.

Вы можете или не можете войти через SFTP, в зависимости от того, как настроен SFTP на удаленной системе. Если вы можете войти через SFTP, вы можете использовать это для проверки, обновления или удаления файлов запуска оболочки. Или вы можете получить доступ к системным журналам (обычно в /var/log), чтобы посмотреть, sshdрегистрируется ли что-либо о причинах завершения сеансов.

Связанный контент