SSH连接下降

我已经build立了一个autossh的连接,在系统启动时创build了一些隧道,但是如果我尝试连接,在成功login(使用RSA密钥)连接失败之后,这里有一个trace:

debug1: Authentication succeeded (publickey). debug1: Remote connections from LOCALHOST:5006 forwarded to local address localhost:22 debug1: Remote connections from LOCALHOST:6006 forwarded to local address localhost:80 debug1: channel 0: new [client-session] debug1: Requesting [email protected] debug1: Entering interactive session. debug1: remote forward success for: listen 5006, connect localhost:22 debug1: remote forward success for: listen 6006, connect localhost:80 debug1: All remote forwarding requests processed debug1: Sending environment. debug1: Sending env LANG = it_IT.UTF-8 debug1: Sending env LC_CTYPE = en_US.UTF-8 debug1: client_input_channel_req: channel 0 rtype exit-status reply 0 debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0 debug1: channel 0: free: client-session, nchannels 1 Transferred: sent 2400, received 2312 bytes, in 1.3 seconds Bytes per second: sent 1904.2, received 1834.4 debug1: Exit status 1 

可能是什么问题?

所有这些东西都由已经在另一台机器上运行的脚本来pipe理(在同一台机器上创build反向通道,但使用不同的端口)

由于客户端正在发送一个环境,但没有命令,这意味着客户端正在尝试以该用户的身份启动一个shell。 但是这个shell立即退出,导致ssh连接终止。

尝试从用户的命令行ssh进入,而无需通过autossh。 它可能会提供一些额外的提示,并且有趣的是知道,如果你能以这种方式获得一个shell。

用户可能已经被configuration了错误的shell,或者通过使用command="…"~/.ssh/authorized_keys覆盖了对shell的访问command="…"

尝试在/ etc / ssh / ssh_config文件中添加KeepAlive选项(或者如果希望应用于单个用户, 则为 〜/ .ssh / config

例如:

  ClientAliveInterval 300 ClientAliveCountMax 2 

如果一个客户,和

 Host * ServerAliveInterval 300 ServerAliveCountMax 2 

如果一台服务器