首页 文章

如何在putty中修复意外的服务器关闭连接

提问于
浏览
0

您好,请帮助我的朋友,我试图通过ssh用putty登录服务器 . 但在设置好主机名和putty之后,它将允许我输入cpanel用户名 . 但有时,它会显示一个消息框(意外的服务器关闭连接) . 请问是网络问题?因为我对这个问题有些不了解 . 我需要建议 . 谢谢 . 这是我的sshd_config我试过@Nic但不能正常工作......这是我的sshd_config

#$ OpenBSD:sshd_config,v 1.65 2003/08/28 12:54:34 markus Exp $

#这是sshd服务器系统范围的配置文件 . 有关更多信息,请参阅#sshd_config(5) .

#这个sshd是用PATH = / usr / bin编译的:/ bin:/ usr / sbin:/ sbin

#用于#OpenSSH附带的默认sshd_config中的选项的策略是指定具有#可能的默认值的选项,但留下它们进行注释 . 未注释的选项会更改#默认值 .

#Port 22

#Protocol 2,1

议定书2

#ListenAddress 0.0.0.0

#ListenAddress ::

协议版本1的#HostKey

#HostKey / etc / ssh / ssh_host_key

#HostKeys用于协议版本2

#HostKey / etc / ssh / ssh_host_rsa_key

#HostKey / etc / ssh / ssh_host_dsa_key

#临时版本1服务器密钥的生命周期和大小

#KeyRegenerationInterval 1h

#ServerKeyBits 768

#Logging

#obsoletes QuietMode和FascistLogging

#SyslogFacility AUTH

#LogLevel INFO

#认证:

#LoginGraceTime 2m

PermitRootLogin是的

#以下设置将覆盖对主机密钥文件的权限检查

#和目录 . 出于安全原因,在运行时将其设置为“是”

#NT / W2K,NTFS和CYGWIN = ntsec .

StrictModes是的

RSAAuthentication没有

#PubkeyAuthentication是的

#AuthorizedKeysFile .ssh / authorized_keys

#为此,您还需要/ etc / ssh / ssh_known_hosts中的主机密钥

#RhostsRSAAuthentication no

#类似于协议版本2

#HostbasedAuthentication no

#如果您不信任〜/ .ssh / known_hosts,则更改为yes

#RhostsRSAAuthentication和HostbasedAuthentication

IgnoreUserKnownHosts是的

#不要读取用户的〜/ .rhosts和〜/ .shosts文件

#IgnoreRhosts是的

#要禁用隧道明文密码,请在此处更改为no!

PasswordAuthentication是的

#PermitEmptyPasswords没有

#更改为no以禁用密钥/密钥密码

#ChallengeResponseAuthentication是的

#Kerberos选项

#KerberosAuthentication no

#KerberosOrLocalPasswd是的

#KerberosTicketCleanup是的

#GSSAPI选项

#GSSAPIAuthentication no

#GSSAPICleanupCreds是的

#将此设置为“yes”以启用PAM身份验证(通过质询 - 响应)

#和会话处理 . 根据您的PAM配置,这可能会

#绕过'PasswordAuthentication'的设置

#UsePAM是的

#AllowTcpForwarding是的

#GatewayPorts没有

#X11转发号码

#X11DisplayOffset 10

#X11UseLocalhost是的

#PrintMotd是的

#PrintLastLog是的

#KeepAlive是的

#UseLogin no

UsePrivilegeSeparation no

#PermitUserEnvironment没有

#Compression yes

#ClientAliveInterval 0

#ClientAliveCountMax 3

#UseDNS是的

#PidFile /var/run/sshd.pid

MaxStartups 10:30:60

#default Banner 路径

Banner /etc/banner.txt

#over默认没有子系统

子系统sftp / usr / sbin / sftp-server

1 回答

  • 0

    前往您的putty设置 - > Connection并将'keepalives之间的秒数'的值设置为类似'30'的值并重试 .

    如果这不起作用,请尝试向我们展示sshd_config的内容

    cat /etc/ssh/sshd_config
    

    编辑:将其添加到您的sshd_config

    # Enable TCPKeepAlive
    TCPKeepAlive yes
    

    祝好运!

相关问题