记录连接SSH时的一些报错及fedora相关命令

编程入门 行业动态 更新时间:2024-10-22 17:20:10

记录连接SSH时的一些<a href=https://www.elefans.com/category/jswz/34/1771188.html style=报错及fedora相关命令"/>

记录连接SSH时的一些报错及fedora相关命令

记录连接SSH时的一些报错及fedora相关命令

openSSH卸载与重装

  1. 卸载

先查看openssh的相关包

[root@rainie ~]# rpm -qa openssh*
openssh-server-6.6.1p1-11.el7.x86_64
openssh-6.6.1p1-11.el7.x86_64
openssh-clients-6.6.1p1-11.el7.x86_64

然后依次卸载

[root@rainie ~]# yum remove openssh-server-6.6.1p1-11.el7.x86_64
[root@rainie ~]# yum remove openssh-clients-6.6.1p1-11.el7.x86_64
[root@rainie ~]# yum remove openssh-6.6.1p1-11.el7.x86_64
  1. 安装

    [root@rainie ~]# yum install -y openssh-server-6.6.1p1-11.el7.x86_64
    [root@rainie ~]# yum install -y openssh-clients-6.6.1p1-11.el7.x86_64

  2. 然后重新启动ssh服务

[root@rainie ~]# service sshd start

sshd服务的状态、重启、启动命令

systemctl status sshd.service
systemctl restart sshd.service
systemctl start sshd.service

sudo service sshd status
sudo service sshd restart
sudo service sshd start

关闭防火墙

systemctl stop firewalld

永久关闭防火墙

禁止开机启动

systemctl disable firewalld

进入root权限模式(有些命令需要在root权限下进行操作)

# su
password:(输入密码)

赋予文件或文件夹权限

chmod 777 /etc/ssh/sshd_config

报错信息:

Server responded "algorithm negotiation failed” .
Key exchange with the remote host failed.This can happen for example if the remote host computer does not support the selected algorithms.

解决方案:

修改ssh的配置文件 vi /etc/ssh/sshd_config

在配置文件中添加:

Ciphers aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr,3des-cbc,arcfour128,arcfour256,arcfour,blowfish-cbc,cast128-cbc
MACs hmac-md5,hmac-sha1,umac-64@openssh,hmac-ripemd160,hmac-sha1-96,hmac-md5-96
KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group1-sha1,curve25519-sha256@libssh

然而我添加之后重启不了ssh服务,通过命令查看报错信息

# /usr/sbin/sshd -T

会提示哪一行有错误,下面是某一行的报错提示

failed with result ‘exit-code’

也就是我刚刚在配置文件中加进去的那一段,去掉之后则可以重启成功,所以正在寻找前个问题的另一种解决方法…

这里可能还会用到一个命令就是查看SeLinux设置的ssh端口,与配置文件里的端口号进行对比看是否已匹配

# semanage port -l | grep ssh

更多推荐

记录连接SSH时的一些报错及fedora相关命令

本文发布于:2024-03-23 21:15:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1742902.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:报错   命令   SSH   fedora

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!