Linux server cannot connect remotely

王林
Release: 2019-12-06 10:40:53
Original
5466 people have browsed it

Linux server cannot connect remotely

1. Check whether SSH is installed (check whether the SSH package is installed)

Enter the command:

rpm -qa | grep ssh
Copy after login

As shown below, the system has been installed by default SSH:

Linux server cannot connect remotely

#If it is not installed, enter:

yum install openssh-server
Copy after login

to install it.

Recommended online video tutorial:linux video tutorial

2. Check whether the SSH service is running:

Enter the command:

/etc/init.d/shhd status
Copy after login

Linux server cannot connect remotely

The above picture shows that the SSH service is started and running.

If it is not enabled, use the following command to enable it.

service shhd start
Copy after login

3. Check whether port 22 is open:

Use command:

netstat -anpt | grep sshd
Copy after login

-a List all options

-p Display and Process name and PID related to the connection

-t List TCP protocol connections

-u List UDP protocol connections

-n Disable reverse domain name resolution (by default netstat will use reverse domain name resolution technology to find the host name corresponding to each IP address. This will slow down the search speed. If you feel that the IP address is enough and there is no need to know the host name, use the -n option to disable the domain name resolution function)

Linux server cannot connect remotely

The above picture shows that port 22 is open. If port 22 is not open, you can check whether the firewall is open:

Note: Basic operation commands of the firewall:

Query the firewall status:

[root@localhost ~]# service iptables status
Copy after login

Linux server cannot connect remotely

The red part on the way shows that port 22 is open. If port 22 of ssh is not opened, open /etc/sysconfig/iptables, add a column

-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
Copy after login

Save and exit, and restart the firewall configuration.

Linux server cannot connect remotely

4. Check whether SSHD is set to boot at this run level.

Enter the command:

chkconfig --list sshd
Copy after login

centos as shown in the figure The SSH server in the 6.5 system has been set to start at boot under this run level. If it is not set to start, use the following command:

Linux server cannot connect remotely

5. After that, you can use remote Connection tool for remote connection.

Recommended related articles and tutorials:linux tutorial

The above is the detailed content of Linux server cannot connect remotely. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!