Home  >  Article  >  Operation and Maintenance  >  What to do if ssh cannot connect to centos7

What to do if ssh cannot connect to centos7

王林
王林Original
2020-05-21 09:51:242855browse

What to do if ssh cannot connect to centos7

First switch to the root user and execute the following command to check whether sshd is installed on this machine.

rpm -qa | grep ssh

If it is not installed, you need to execute the following command to install it.

yum install openssh-server

What to do if ssh cannot connect to centos7

#Then start the SSH service. Enter the following command to restart the ssh service.

service sshd restart

Command: service sshd start Start service | Command: service sshd stop Stop service

After restarting, you can enter: netstat -antp | grep sshd to check whether port 22 is started (optional)

What to do if ssh cannot connect to centos7

Finally set the service to automatically start at boot

Enter the following command

chkconfig sshd on

Note: If chkconfig sshd off, SSH is prohibited from starting at boot.

Recommended tutorial: centos tutorial

The above is the detailed content of What to do if ssh cannot connect to centos7. 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