Home Operation and Maintenance CentOS What to do if centos ssh fails to connect

What to do if centos ssh fails to connect

Jan 27, 2022 pm 04:06 PM

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 of this Website
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

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

CentOS Containerization with Docker: Deploying and Managing Applications CentOS Containerization with Docker: Deploying and Managing Applications Apr 03, 2025 am 12:08 AM

Using Docker to containerize, deploy and manage applications on CentOS can be achieved through the following steps: 1. Install Docker, use the yum command to install and start the Docker service. 2. Manage Docker images and containers, obtain images through DockerHub and customize images using Dockerfile. 3. Use DockerCompose to manage multi-container applications and define services through YAML files. 4. Deploy the application, use the dockerpull and dockerrun commands to pull and run the container from DockerHub. 5. Carry out advanced management and deploy complex applications using Docker networks and volumes. Through these steps, you can make full use of D

CentOS Backup and Recovery: Ensuring Data Integrity and Availability CentOS Backup and Recovery: Ensuring Data Integrity and Availability Apr 04, 2025 am 12:02 AM

The steps for backup and recovery in CentOS include: 1. Use the tar command to perform basic backup and recovery, such as tar-czvf/backup/home_backup.tar.gz/home backup/home directory; 2. Use rsync for incremental backup and recovery, such as rsync-avz/home//backup/home_backup/ for the first backup. These methods ensure data integrity and availability and are suitable for the needs of different scenarios.

Centos stops maintenance 2024 Centos stops maintenance 2024 Apr 14, 2025 pm 08:39 PM

CentOS will be shut down in 2024 because its upstream distribution, RHEL 8, has been shut down. This shutdown will affect the CentOS 8 system, preventing it from continuing to receive updates. Users should plan for migration, and recommended options include CentOS Stream, AlmaLinux, and Rocky Linux to keep the system safe and stable.

How to optimize CentOS HDFS configuration How to optimize CentOS HDFS configuration Apr 14, 2025 pm 07:15 PM

Improve HDFS performance on CentOS: A comprehensive optimization guide to optimize HDFS (Hadoop distributed file system) on CentOS requires comprehensive consideration of hardware, system configuration and network settings. This article provides a series of optimization strategies to help you improve HDFS performance. 1. Hardware upgrade and selection resource expansion: Increase the CPU, memory and storage capacity of the server as much as possible. High-performance hardware: adopts high-performance network cards and switches to improve network throughput. 2. System configuration fine-tuning kernel parameter adjustment: Modify /etc/sysctl.conf file to optimize kernel parameters such as TCP connection number, file handle number and memory management. For example, adjust TCP connection status and buffer size

CentOS Interview Questions: Ace Your Linux System Administrator Interview CentOS Interview Questions: Ace Your Linux System Administrator Interview Apr 09, 2025 am 12:17 AM

Frequently asked questions and answers to CentOS interview include: 1. Use the yum or dnf command to install software packages, such as sudoyumininstallnginx. 2. Manage users and groups through useradd and groupadd commands, such as sudouseradd-m-s/bin/bashnewuser. 3. Use firewalld to configure the firewall, such as sudofirewall-cmd--permanent-add-service=http. 4. Set automatic updates to use yum-cron, such as sudoyumininstallyum-cron and configure apply_updates=yes.

What are the methods of tuning performance of Zookeeper on CentOS What are the methods of tuning performance of Zookeeper on CentOS Apr 14, 2025 pm 03:18 PM

Zookeeper performance tuning on CentOS can start from multiple aspects, including hardware configuration, operating system optimization, configuration parameter adjustment, monitoring and maintenance, etc. Here are some specific tuning methods: SSD is recommended for hardware configuration: Since Zookeeper's data is written to disk, it is highly recommended to use SSD to improve I/O performance. Enough memory: Allocate enough memory resources to Zookeeper to avoid frequent disk read and write. Multi-core CPU: Use multi-core CPU to ensure that Zookeeper can process it in parallel.

How to check CentOS HDFS configuration How to check CentOS HDFS configuration Apr 14, 2025 pm 07:21 PM

Complete Guide to Checking HDFS Configuration in CentOS Systems This article will guide you how to effectively check the configuration and running status of HDFS on CentOS systems. The following steps will help you fully understand the setup and operation of HDFS. Verify Hadoop environment variable: First, make sure the Hadoop environment variable is set correctly. In the terminal, execute the following command to verify that Hadoop is installed and configured correctly: hadoopversion Check HDFS configuration file: The core configuration file of HDFS is located in the /etc/hadoop/conf/ directory, where core-site.xml and hdfs-site.xml are crucial. use

How to train PyTorch model on CentOS How to train PyTorch model on CentOS Apr 14, 2025 pm 03:03 PM

Efficient training of PyTorch models on CentOS systems requires steps, and this article will provide detailed guides. 1. Environment preparation: Python and dependency installation: CentOS system usually preinstalls Python, but the version may be older. It is recommended to use yum or dnf to install Python 3 and upgrade pip: sudoyumupdatepython3 (or sudodnfupdatepython3), pip3install--upgradepip. CUDA and cuDNN (GPU acceleration): If you use NVIDIAGPU, you need to install CUDATool

See all articles