search
HomeOperation and MaintenanceCentOSWhat to do if centos ssh fails to connect

The solution to centos ssh failure to connect: 1. Install "openssh-server"; 2. Remove the # number before the listening port and listening address; 3. Enable the sshd service; 4. Open "ICMPv4-in "That's the rule.

What to do if centos ssh fails to connect

The operating environment of this article: CentOS 7 system, DELL G3 computer

What should I do if centos ssh cannot connect?

linux centos7 cannot connect to ssh

When centos7 connected to ssh, I referred to the following blog post and finally solved it perfectly

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

#Here shows that it has been installed openssh-server. If there is no output, it means that openssh-server is not installed. Enter yum install openssh-server

##to proceed Install openssh-server##2,

Found the sshd service configuration file in the /etc/ssh/ directory sshd_config, open it with Vim editor

Remove the # number before the listening port and listening address in the file

Then enable remote login

Finally

, enable the use of username and password as connection verification

##Save the

file and exit

3,

Start the sshd service and enter

sudo service sshd start

##Check whether the sshd service is running Turn on, enter

ps -e | grep sshd

##or Enter netstat -an | grep 22 Check ## Whether port #22 is enabled for monitoring

##4,

In Vmware Workstation, Check the properties of CentOS7 and find that the network connection method is NAT.

5

, In Vmware Workstation, Click Edit=》Virtual Network Editor, enter the virtual network editor, and check the NAT mode The network adapter name used for the connection is VMnet8

##6

,

In the windows host, enter ipconfig in the command line View the host IP and find the connection information of VMnet8. The ip here is 192.168.30.1

7

In CentOS, enter ifconfig to view the network Connect the address and find that the network address of CentOS is 192.168.112.128

##8. in CentOS , enter ping 192.168.30.1

to test whether the host can be connected, and find that it cannot be connected In the host, enter ping 192.168.112.128 to test whether Can connect to centos, found that it can be connected

##The next operation is: turn off the Linux firewall, found that the host can be pinged, indicating that the firewall is blocking

After checking the information, I found out that It turned out that Windows firewall was not turned on

ICMPv4-in This rule Open the firewall settings, select Advanced Settings, Inbound Rules, and set the profile type to "Public" "

File and Print Sharing (Echo Request – ICMPv4-In

)" rule, set to Allow.

After the setting is completed, it is found that the connection can be made normally

9.In order to avoid each The first time you start CentOS, you must manually start the sshd service. You can add the sshd service to the auto-start list and enter systemctl enable sshd.service

You can view it by entering systemctl list-unit-files | grep sshd Whether the sshd service auto-start is enabled

## Recommended: "

centos usage tutorial"

The above is the detailed content of What to do if centos ssh fails to connect. 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
How to restart the server via command line in CentOS systemHow to restart the server via command line in CentOS systemMar 05, 2025 pm 03:30 PM

This article explains how to restart a CentOS server using the command-line reboot command. It emphasizes the importance of saving data and gracefully shutting down applications before using sudo reboot to avoid data loss. Potential risks, includin

How to restart the network service in centos8How to restart the network service in centos8Mar 05, 2025 pm 03:29 PM

This guide details methods for restarting network services in CentOS 8. It compares using systemctl (recommended for reliability) with ifdown/ifup (faster, less robust). Troubleshooting steps for network outages are also provided, covering connecti

What are the centos restart commandsWhat are the centos restart commandsMar 05, 2025 pm 03:28 PM

This article explains CentOS server reboot commands. It focuses on reboot for immediate restarts and shutdown -r for scheduled reboots, highlighting the differences and best practices for each. The main issue is providing clear instructions and con

Centos official website entranceCentos official website entranceMar 05, 2025 pm 03:32 PM

This article discusses the discontinuation of CentOS and its replacement by CentOS Stream. It details how to find information, downloads, and verify the integrity of CentOS Stream ISOs, now primarily hosted on the Red Hat website. Community support

How do I use Logical Volume Management (LVM) in CentOS to manage storage?How do I use Logical Volume Management (LVM) in CentOS to manage storage?Mar 17, 2025 pm 04:51 PM

The article discusses using Logical Volume Management (LVM) in CentOS for efficient storage management, detailing steps for setup, extension, and backup/restore processes, and highlighting LVM's advantages over traditional partitioning.

How to shut down and restart centos7 shutdown and restart commandHow to shut down and restart centos7 shutdown and restart commandMar 05, 2025 pm 03:24 PM

This guide details safe shutdown and reboot methods for CentOS 7 servers. It emphasizes using the shutdown command for its flexibility and ability to schedule restarts, contrasting it with the less-flexible reboot and halt commands. Safe practices

How do I install and configure MySQL/MariaDB on CentOS?How do I install and configure MySQL/MariaDB on CentOS?Mar 17, 2025 pm 04:35 PM

Article discusses installation, configuration, and troubleshooting of MySQL/MariaDB on CentOS, including system requirements and security measures.(159 characters)

How do I configure log rotation in CentOS?How do I configure log rotation in CentOS?Mar 17, 2025 pm 04:43 PM

The article explains how to configure log rotation in CentOS using logrotate, detailing installation, configuration, and benefits like disk space management and security.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.