Home > Article > Operation and Maintenance > What should I do if ssh cannot connect to centos?
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.
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
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).
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.
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!