首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我可以平一台服务器,但不能通过ssh连接?

我可以平一台服务器,但不能通过ssh连接?
EN

Server Fault用户
提问于 2017-05-19 02:49:22
回答 1查看 2.1K关注 0票数 1

当我平我的服务器时,它会响应:

代码语言:javascript
复制
Pinging 192.168.2.222 with 32 bytes of data:
Reply from 192.168.2.222: bytes=32 time<1ms TTL=64
Reply from 192.168.2.222: bytes=32 time<1ms TTL=64
Reply from 192.168.2.222: bytes=32 time<1ms TTL=64
Reply from 192.168.2.222: bytes=32 time<1ms TTL=64

Ping statistics for 192.168.2.222:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

当我使用Xshell连接服务器时,它会响应,但在以下行停止:

代码语言:javascript
复制
Connecting to 192.168.2.222:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.

Rstudio服务器正在服务器上运行,192.168.2.222:8787也没有响应(总是处于连接状态)。然后我尝试使用调试进行ssh,它在最后一行也停止了:

代码语言:javascript
复制
>ssh -vvv 192.168.2.222
OpenSSH_7.1p2, OpenSSL 1.0.1g 7 Apr 2014
debug1: Reading configuration data /etc/ssh_config
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.2.222 [192.168.2.222] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/mobaxterm/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/mobaxterm/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/mobaxterm/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/mobaxterm/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/mobaxterm/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/mobaxterm/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/mobaxterm/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/mobaxterm/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.1

然后,我尝试使用以下命令行来诊断服务器:

代码语言:javascript
复制
>nc -v -w 1 192.168.2.222 22
Connection to 192.168.2.222 22 port [tcp/ssh] succeeded!

我还是搞不清到底是怎么回事!当我去服务器室时,服务器没有存储任何带有黑色屏幕的东西。手动重新启动计算机后,可以使用ssh登录计算机。但过了几个小时,问题又发生了!我真的不知道问题出在哪里,我只是个学生,对linux服务器不太了解。运行CentOS 6.5的服务器。

EN

回答 1

Server Fault用户

发布于 2017-05-19 07:05:29

ssh协议/包可能会出现问题,尝试重新安装或升级打开的ssh服务器包并重新生成密钥。

如何重新生成新的ssh服务器键

这是一个不同寻常的主题,因为大多数发行版都在安装OpenSSH服务器包期间为您创建这些密钥。但是,能够不时生成新的服务器密钥可能很有用,当我复制包含已安装的ssh包的时,就会发生这种情况。OpenSSH需要不同的密钥,这取决于您是否使用SSH1和/或SSH2协议。所有的键都是由ssh-keygen生成的,这个键应该在您的系统中使用ssh包。收据几乎与生成您自己的密钥相同,只是您应该使用一个空密码。默认密钥长度也是合适的( rsa为2048位,dsa为1024位)。

SSH1协议用于SSH1协议,需要生成的rsa1密钥有以下几个: ssh-keygen -q -f /etc/ssh/ssh_host_key -N '‘-t rsa1

SSH2协议用于SSH2协议,您需要两个密钥,一个RSA密钥和一个SSH2密钥生成如下:

ssh-keygen -f /etc/ssh/ssh_host_ rsa _key -N '‘-t rsa

-f /etc/ssh/ssh_host_ dsa _key -N‘-t dsa

自2011年1月起,OpenSSH还支持ECDSA密钥,您可以使用以下方法生成一个新的密钥: ssh-keygen -f /etc/ssh/ssh_host_ ecdsa _key -N‘-t ecdsa -b 521

票数 -1
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/851025

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档