Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem that ssh cannot connect to linux remotely

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

The remote connection tool is: Xmanager Enterprise 5mura-> Xshell

The linux distribution is: CentOS-6.3-x86_64

The solution is as follows:

First, check whether the IP in the network configuration file has changed.

First check to see if the IPADDR has changed, and if not, proceed to step 2; if so, change the IPADDR to the previous one, and then proceed to step 2.

[root@fanycb ~] # cat / etc/sysconfig/network-scripts/ifcfg-eth0DEVICE= "eth0" BOOTPROTO=noneNM_CONTROLLED= "yes" ONBOOT= "yes" TYPE= "Ethernet" e57636db-84f8-4c15-af74-97d44a107fa2 "HWADDR=00:0C:29:14:5A:57IPADDR=192.168.1.100PREFIX=24GATEWAY=192.168.1.1DEFROUTE=yesIPV4_FAILURE_FATAL=yesIPV6INIT=noNAME=" System eth0 "[root@fanycb] #

Check the status of the sshd service and whether the port is normal

1. Check whether port 22 of sshd is in a normal LISTEN state, if so, proceed to step 3; if not, restart the sshd service, and then proceed to step 3

2. Restart the sshd service

Third, check whether the firewall is turned on

If the firewall is off, proceed to step 4; if the firewall is not turned off, turn it off permanently, and then proceed to step 4.

4. Check whether SELinux is turned on

If the result is also "disabled", then all the checks will be ok, and then you can connect.

But if the result is "Enforcing" or "permissive", the SELinux on the system is on and needs to be turned off.

Because the opening and closing of SELinux is related to the closing of two important configuration files, / etc/selinux/config and / boot/grub/menu.lst, you need to modify these two files to close SELinux, as follows:

[root@fanycb ~] # cat / etc/selinux/config # This file controls the state of SELinux on the system.# SELINUX= can take one of these three values:# enforcing-SELinux security policy is enforced.# permissive-SELinux prints warnings instead of enforcing.# disabled-No SELinux policy is loaded.#SELINUX=enforcingSELINUX=disabled

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report