Home >Operation and Maintenance >CentOS >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
#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)
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!