Solution:
1. Uninstall and reinstall
[root@cent ~]# yum -y remove openssh-server [root@cent ~]# yum -y install openssh-server
2. Generate key (optional)
[root@cent ~]# sshd-keygen
3 , Modify the sshd_config configuration file
[root@cent ~]# vim /etc/ssh/sshd_config # 添加以下内容至文件末尾处 :wq PubkeyAuthentication yes
4. Restart sshd
[root@cent ~]# systemctl restart sshd.service
Recommended related tutorials: centos tutorial
The above is the detailed content of What to do if ssh login fails under centos. For more information, please follow other related articles on the PHP Chinese website!