Home  >  Article  >  Operation and Maintenance  >  What should I do if ssh cannot connect to centos?

What should I do if ssh cannot connect to centos?

coldplay.xixi
coldplay.xixiOriginal
2020-07-28 15:04:225526browse

The solution to the problem that ssh cannot connect to centos: first add an ens33 network configuration to the wired connection; then switch to the root user and check whether ssh is installed on the machine; then start the SSH service; finally set the boot Just start the service automatically.

What should I do if ssh cannot connect to centos?

Solution to ssh failure to connect to centos:

1. IP addr found that the network card name is ens33

2. The ifcfg-ens33 file cannot be found in the /etc/sysconfig/network-scripts/ directory. The file is included in the picture below because it was a picture I took after the problem was solved.

You need to add an ens33 network configuration to the wired connection

What should I do if ssh cannot connect to centos?

What should I do if ssh cannot connect to centos?

3. After switching to the root user, check Whether ssh is installed on this machine. If it is not installed, you need yum install openssh-server to install the software.

4. Start the SSH service. Enter the command: service sshd restart to restart the SSH service.

Command: service sshd start Start the service

Command: service sshd stop Stop the service

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

What should I do if ssh cannot connect to centos?

5. Set the service to automatically start at boot

Enter the command:

chkconfig sshd on

.

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

What should I do if ssh cannot connect to centos?

Recommended related tutorials: centos tutorial

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