我正在尝试远程 ssh 进入我的 ubuntu 18.04,但在密码验证后,我的 ssh 命令执行挂起。我尝试了很多我在网上找到的解决方案,但到目前为止都没有奏效。
使用以下命令我得到以下输出:
ssh -vvvvv <user>@<IP>
[email protected]'s password:
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 10.151.193.90 ([10.151.193.90]:22).
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 80
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug3: receive packet: type 91
debug2: channel_input_open_confirmation: channel 0: 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
debug3: send packet: type 98
debug1: Sending environment.
debug3: Ignored env CLUTTER_IM_MODULE
debug3: Ignored env CONDA_SHLVL
debug3: Ignored env LS_COLORS
debug3: Ignored env CONDA_EXE
debug3: Ignored env LESSCLOSE
debug3: Ignored env XDG_MENU_PREFIX
debug1: Sending env LANG = en_US.UTF-8
debug2: channel 0: request env confirm 0
debug3: send packet: type 98
debug3: Ignored env DISPLAY
debug3: Ignored env GNOME_SHELL_SESSION_MODE
debug3: Ignored env COLORTERM
debug3: Ignored env USERNAME
debug3: Ignored env XDG_VTNR
debug3: Ignored env SSH_AUTH_SOCK
debug3: Ignored env _CE_M
debug3: Ignored env XDG_SESSION_ID
debug3: Ignored env USER
debug3: Ignored env DESKTOP_SESSION
debug3: Ignored env QT4_IM_MODULE
debug3: Ignored env TEXTDOMAINDIR
debug3: Ignored env GNOME_TERMINAL_SCREEN
debug3: Ignored env PWD
debug3: Ignored env HOME
debug3: Ignored env CONDA_PYTHON_EXE
debug3: Ignored env TEXTDOMAIN
debug3: Ignored env SSH_AGENT_PID
debug3: Ignored env QT_ACCESSIBILITY
debug3: Ignored env XDG_SESSION_TYPE
debug3: Ignored env XDG_DATA_DIRS
debug3: Ignored env _CE_CONDA
debug3: Ignored env XDG_SESSION_DESKTOP
debug3: Ignored env GJS_DEBUG_OUTPUT
debug3: Ignored env GTK_MODULES
debug3: Ignored env WINDOWPATH
debug3: Ignored env TERM
debug3: Ignored env SHELL
debug3: Ignored env VTE_VERSION
debug3: Ignored env QT_IM_MODULE
debug3: Ignored env XMODIFIERS
debug3: Ignored env IM_CONFIG_PHASE
debug3: Ignored env XDG_CURRENT_DESKTOP
debug3: Ignored env GPG_AGENT_INFO
debug3: Ignored env GNOME_TERMINAL_SERVICE
debug3: Ignored env XDG_SEAT
debug3: Ignored env SHLVL
debug3: Ignored env GDMSESSION
debug3: Ignored env GNOME_DESKTOP_SESSION_ID
debug3: Ignored env LOGNAME
debug3: Ignored env DBUS_SESSION_BUS_ADDRESS
debug3: Ignored env XDG_RUNTIME_DIR
debug3: Ignored env XAUTHORITY
debug3: Ignored env XDG_CONFIG_DIRS
debug3: Ignored env PATH
debug3: Ignored env GJS_DEBUG_TOPICS
debug3: Ignored env SESSION_MANAGER
debug3: Ignored env LESSOPEN
debug3: Ignored env GTK_IM_MODULE
debug3: Ignored env _
debug2: channel 0: request shell confirm 1
debug3: send packet: type 98
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug3: receive packet: type 100
debug2: channel_input_status_confirm: type 100 id 0
PTY allocation request failed 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
我尝试了下面的命令并得到如下输出:
ssh -vvvvv <user>@<IP> "/bin/bash -i"
[email protected]'s password:
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 10.151.193.90 ([10.151.193.90]:22).
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 80
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug3: receive packet: type 91
debug2: channel_input_open_confirmation: channel 0: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: ssh_packet_set_tos: set IP_TOS 0x08
debug2: client_session2_setup: id 0
debug1: Sending environment.
debug3: Ignored env CLUTTER_IM_MODULE
debug3: Ignored env CONDA_SHLVL
debug3: Ignored env LS_COLORS
debug3: Ignored env CONDA_EXE
debug3: Ignored env LESSCLOSE
debug3: Ignored env XDG_MENU_PREFIX
debug1: Sending env LANG = en_US.UTF-8
debug2: channel 0: request env confirm 0
debug3: send packet: type 98
debug3: Ignored env DISPLAY
debug3: Ignored env GNOME_SHELL_SESSION_MODE
debug3: Ignored env COLORTERM
debug3: Ignored env USERNAME
debug3: Ignored env XDG_VTNR
debug3: Ignored env SSH_AUTH_SOCK
debug3: Ignored env _CE_M
debug3: Ignored env XDG_SESSION_ID
debug3: Ignored env USER
debug3: Ignored env DESKTOP_SESSION
debug3: Ignored env QT4_IM_MODULE
debug3: Ignored env TEXTDOMAINDIR
debug3: Ignored env GNOME_TERMINAL_SCREEN
debug3: Ignored env PWD
debug3: Ignored env HOME
debug3: Ignored env CONDA_PYTHON_EXE
debug3: Ignored env TEXTDOMAIN
debug3: Ignored env SSH_AGENT_PID
debug3: Ignored env QT_ACCESSIBILITY
debug3: Ignored env XDG_SESSION_TYPE
debug3: Ignored env XDG_DATA_DIRS
debug3: Ignored env _CE_CONDA
debug3: Ignored env XDG_SESSION_DESKTOP
debug3: Ignored env GJS_DEBUG_OUTPUT
debug3: Ignored env GTK_MODULES
debug3: Ignored env WINDOWPATH
debug3: Ignored env TERM
debug3: Ignored env SHELL
debug3: Ignored env VTE_VERSION
debug3: Ignored env QT_IM_MODULE
debug3: Ignored env XMODIFIERS
debug3: Ignored env IM_CONFIG_PHASE
debug3: Ignored env XDG_CURRENT_DESKTOP
debug3: Ignored env GPG_AGENT_INFO
debug3: Ignored env GNOME_TERMINAL_SERVICE
debug3: Ignored env XDG_SEAT
debug3: Ignored env SHLVL
debug3: Ignored env GDMSESSION
debug3: Ignored env GNOME_DESKTOP_SESSION_ID
debug3: Ignored env LOGNAME
debug3: Ignored env DBUS_SESSION_BUS_ADDRESS
debug3: Ignored env XDG_RUNTIME_DIR
debug3: Ignored env XAUTHORITY
debug3: Ignored env XDG_CONFIG_DIRS
debug3: Ignored env PATH
debug3: Ignored env GJS_DEBUG_TOPICS
debug3: Ignored env SESSION_MANAGER
debug3: Ignored env LESSOPEN
debug3: Ignored env GTK_IM_MODULE
debug3: Ignored env _
debug1: Sending command: /bin/bash -i
debug2: channel 0: request exec confirm 1
debug3: send packet: type 98
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 2097152
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: exec request accepted on channel 0
我也尝试向 ssh 发出如下命令,但它挂在与上述相同的位置:
ssh -vvvvv <user>@<IP> "uptime"
我也尝试过卸载和安装 /dev/pts,但没有帮助。还尝试UseDNS no
在 sshd_config 文件中添加,但没有任何变化。尝试在此主机上创建另一个用户以验证这是否是某些用户特定的问题,但没有成功。尝试传递选项ssh -o IPQoS=throughput ...
,但也没有帮助。
谁能指出我这里可能存在什么问题。
答案1
请尝试以下操作:
ssh -vvvvv 用户@IP "/bin/bash --noprofile --norc -i"
如果这样您就可以登录,那么问题可能出在您的 ~/.bashrc 或 /etc/profile 上。那里有些东西挂了。
答案2
我最终通过注释掉 sshd_config 文件中的几行解决了这个问题。我之前添加了一些配置设置以允许 X11 转发。我的电脑重新启动了,它重新启动了 sshd 服务器,从而停止了所有传入的 ssh 连接。它现在正在工作。感谢大家提出的故障排除建议。