报错及fedora相关命令"/>
记录连接SSH时的一些报错及fedora相关命令
记录连接SSH时的一些报错及fedora相关命令
openSSH卸载与重装
- 卸载
先查看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
-
安装
[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 -
然后重新启动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相关命令
发布评论