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

What should I do if centos cannot access ssh?

coldplay.xixi
coldplay.xixiOriginal
2020-06-24 10:05:126554browse

What should I do if centos cannot access ssh?

Solution to the problem that centos cannot access ssh:

1. First, make sure CentOS7 has openssh-server installed and enter # in the terminal. ##yum list installed | grep openssh-server

What should I do if centos cannot access ssh?

It shows that

openssh-server has been installed. If there is no output, Indicates that openssh-server is not installed. Install openssh-server by typing yum install openssh-server

What should I do if centos cannot access ssh?

2. Found the sshd service configuration file

sshd_config in the /etc/ssh/ directory and open it with Vim editor

In the file, remove the # number before the listening port and listening address

What should I do if centos cannot access ssh?

and then enable remote login

What should I do if centos cannot access ssh?## Finally, enable the use of username and password as connection verification

What should I do if centos cannot access ssh?Save the file and exit

3. Start the sshd service and enter

sudo service sshd start

What should I do if centos cannot access ssh?Check whether the sshd service has been started, enter

ps -e | grep sshd

What should I do if centos cannot access ssh?Or enter

netstat -an | grep 22

Check whether port 22 is open for listening

What should I do if centos cannot access ssh?4. In Vmware Workstation, check the properties of CentOS7 , it is found that the network connection method is connected by NAT method

What should I do if centos cannot access ssh?5. In Vmware Workstation, click Edit => Virtual Network Editor, enter the virtual network editor, and view It is found that the network adapter name used in the NAT mode connection is VMnet8

What should I do if centos cannot access ssh?#6. In the windows host, enter ipconfig in the command line to view the host IP and find the connection information of VMnet8. The ip here is 192.168.30.1

What should I do if centos cannot access ssh?7. In CentOS, enter ifconfig to view the network connection address and find that the network address of CentOS is 192.168.112.128

What should I do if centos cannot access ssh?8. In CentOS, enter

ping 192.168.30.1

to test whether the host can be connected. If you find that you cannot connect to the host, enter ping 192.168.112.128 to test whether you can connect to centos. It is found that the connection can be connected. The next operation is: turn off the Linux firewall and find that the host can be pinged. It means that the firewall is blocking it.After checking the information, it turns out that the Windows firewall has not turned on the ICMPv4-in rule

Open the firewall settings, select Advanced Settings, Inbound Rules, and set the "File and Print Sharing (Echo Request – ICMPv4-In)" rule with the configuration file type "Public" to Allow.

What should I do if centos cannot access ssh?After the setting is completed, it is found that the connection can be normal

9. In order to avoid having to manually start the sshd service every time you start CentOS, you can use sshd Add the service to the auto-start list, enter

systemctl enable sshd.service

What should I do if centos cannot access ssh?You can enter

systemctl list-unit-files | grep sshd ,

Check whether the sshd service auto-start is enabled.

What should I do if centos cannot access ssh? Recommended tutorial: "

centos tutorial

"

The above is the detailed content of What should I do if centos cannot access ssh?. 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