Home >Operation and Maintenance >CentOS >What to do if ssh login fails on centos

What to do if ssh login fails on centos

王林
王林Original
2020-05-19 15:27:593668browse

What to do if ssh login fails on centos

The solution is as follows:

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 tutorial: centos tutorial

The above is the detailed content of What to do if ssh login fails on centos. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn