【服务器】无法进行ssh连接的问题逐一排查以及解决方法
创始人
2025-01-20 08:03:51
0次

一、检查服务器网络

先检查是否是网络的问题。按快捷键Win+R,在弹出的对话框中输入cmd。
在这里插入图片描述
点击确定运行。在cmd窗口输入ping一下服务器的ip地址。

在这里插入图片描述

如果出现请求超时,解决办法如下:

在服务器端输入ifconfig命令,查看要连接的网络的状态。如果服务器网卡正常,可能是连接时输入的ip地址错误,在xshell客户端输入正确的ip重新连接即可;否则就要重新配置网卡。

二、 检查端口是否开启

如果ip地址可以ping通,就要排查端口问题。在cmd窗口中,用telnet命令进行测试。
在这里插入图片描述

1. 如果显示连接失败,可能是端口未开,需要在服务器上查看端口信息。

netstat -ntlp|grep 22 

在这里插入图片描述

2. 输入命令后,如果没有22端口的信息,就需要开放端口号。执行以下命令后再使用xshell重新连接服务器。

在这里插入图片描述

三、 检查SSH服务

ps -le|grep ssh 

在这里插入图片描述

上图表示SSH服务已开启。如果没有启动,则需要执行命令“service ssh start”启动服务,然后重连服务器。

四、查看运行状态并启动ssh服务时报错

查看ssh运行状态:

systemctl status sshd.service 

发现服务未启动,尝试使用命令

/etc/init.d/sshd start 

启动服务,结果失败

使用命令journalctl -xe查看失败的具体原因,发现:

sshd: /lib/libcrypto.so.10: version `OPENSSL_1.0.2’ not found (required by sshd)

此时执行:

cp /usr/lib64/libcrypto.so.10 /usr/lib 

最后重启ssh即可

1. 无法loading libgcc_s.so.1的问题

再次报错:

rpm: error while loading shared libraries: libgcc_s.so.1: cannot open
shared object file: No such file or directory

libgcc_s.so.1: cannot open shared object file: No such file or
directory

这是系统乱删rpm导致再次安装包时出现 error while loading shared libraries: libgcc_s.so.1所产生的问题

解决:

安装libgcc_s.so.1包

# For RedHat (or similar distributions): yum install libgcc_s.so.1  # For Debian (or similar distributions): apt-get install libgcc_s.so.1 

2. 安装libgcc 时

Error: Multilib version problems found. This often means that the root
cause is something else and multilib version checking is just
pointing out that there is a problem. Eg.:

     1. You have an upgrade for libgcc which is missing some         dependency that another package requires. Yum is trying to         solve this by installing an older version of libgcc of the         different architecture. If you exclude the bad architecture         yum will tell you what the root cause is (which package         requires what). You can try redoing the upgrade with         --exclude libgcc.otherarch ... this should give you an error         message showing the root cause of the problem.          2. You have multiple architectures of libgcc installed, but         yum can only see an upgrade for one of those arcitectures.         If you don't want/need both architectures anymore then you         can remove the one with the missing update and everything         will work.          3. You have duplicate versions of libgcc installed already.         You can use "yum check" to get yum show these errors.        ...you can also use --setopt=protected_multilib=false to remove    this checking, however this is almost never the correct thing to    do as something else is very likely to go wrong (often causing    much more problems).        Protected multilib versions: libgcc-4.4.7-4.el6.i686 != libgcc-4.4.7-3.el6.x86_64    You could try using --skip-broken to work around the problem    You could try running: rpm -Va --nofiles –nodigest 

原理:
这是由于多个libgcc版本冲突所导致。libgcc_x86_64的版本与libgcc不同。尝试在安装libgcc_s库的同时更新libgcc_s_64库:

解决方案:

yum install libgcc.x86_64 libgcc_s.so.1 

此时重启服务器以及重启ssh服务——成功解决!

相关内容

热门资讯

不少玩家反映开挂教材!大胜跑得... 不少玩家反映开挂教材!大胜跑得快多功能开挂工具,大胜跑得快一贯存在有辅助工具运大胜跑得快辅助工具,进...
我来向大家传授外挂攻略!逍遥皖... 我来向大家传授外挂攻略!逍遥皖北棋牌多功能外挂攻略,逍遥皖北棋牌本来有外挂攻略1、每一步都需要思考,...
一分钟了解开挂手筋!威信茶馆大... 一分钟了解开挂手筋!威信茶馆大二多功能开挂工具,威信茶馆大二原来真的是有辅助工具1、金币登录送、破产...
推荐一款外挂攻略!悠乐汇多功能... 推荐一款外挂攻略!悠乐汇多功能外挂攻略,悠乐汇真是是有外挂攻略1、全新机制【悠乐汇ai辅助工具激活码...
一分钟快速了解开挂技巧!闲来麻... 一分钟快速了解开挂技巧!闲来麻将多功能开挂技巧,闲来麻将果然真的有开挂技巧1、下载好闲来麻将透视辅助...
重大消息辅助挂课程!同城游贵阳... 重大消息辅助挂课程!同城游贵阳捉鸡麻将多功能辅助挂软件,同城游贵阳捉鸡麻将一贯真的有辅助软件1、点击...
玩家必知教程透视阶段!蜀州麻将... 玩家必知教程透视阶段!蜀州麻将海宁多功能透视教程,蜀州麻将海宁竟然是有辅助教程1)蜀州麻将海宁有没有...
详细说明透视器插件!云鹤九霄多... 详细说明透视器插件!云鹤九霄多功能透视器插件,云鹤九霄一贯真的是有透视器插件1)云鹤九霄辅助插件:进...
玩家必备教程外挂教程!小白大作... 玩家必备教程外挂教程!小白大作战多功能外挂教程,小白大作战竟然真的是有外挂教程1、用户打开应用后不用...
推荐十款透视挂要领!放炮罚多功... 推荐十款透视挂要领!放炮罚多功能透视挂工具,放炮罚好像是有辅助工具小薇(辅助器软件下载)致您一封信;...