SSH remote connection not on Linux

Source: Internet
Author: User

The Remote Connection tool is: Xmanager Enterprise 5-->xshell

The Linux distribution is: centos-6.3-x86_64

Problem: SSH has been able to remotely connect to Linux, a period of time after a sudden ssh using the original IP connection is not on Linux, the solution when this happens

1. Check that the IP in the network configuration file has not changed.

First see if the ipaddr has changed, if not changed, then proceed to step 2, if there is a change, ipaddr to the previous, then proceed to step 2.

[Email protected] ~]# cat/etc/sysconfig/network-scripts/ifcfg-eth0DEVICE="eth0"Bootproto=nonenm_controlled="Yes"Onboot="Yes"TYPE="Ethernet"UUID="E57636DB-84F8-4C15-AF74-97D44A107FA2"HWADDR=xx: 0C: in: -: 5 A: $ ipaddr=192.168. 1.100 PREFIX= -GATEWAY=192.168.1.1Defroute=Yesipv4_failure_fatal=Yesipv6init=NoNAME="System eth0"[[Email protected]~]#

2. Check the status of the SSHD service and the port is healthy.

    • Check whether the 22 port of sshd is in the normal listen state, if normal, proceed to step 3; If not, restart the SSHD service and proceed to step 3;
NETSTAT-NLP | grep:22TCP    0      0 0.0.0.0:          0.0.0.0:*         LISTEN      2896 /sshd           TCP 0::: $:                        ::*           LISTEN      2896/sshd  
    • Restarting the SSHD service
/etc/init.d/sshd Restart stop sshd:                                               [OK] starting sshd:                                            [OK]

3. Check that the firewall is turned on.

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

[[Email protected] ~chkconfig iptables off  <==== permanently shut down the firewall  /etc/init.d/ C5>iptables status  <==== then check to see if the iptables is off: Firewall is not running 

4. It is also important to check if SELinux is turned on.

View the current status of the system SELinux

[Email protected] ~getenforceDisabled <==== This is the status of SELinux on my system, this is off                          ~]#

If the result is also "disabled", then all the checks are OK, then you can connect the

But if the result is "enforcing" alive "permissive", indicating that selinux on the system is on, it needs to be shut down. Because SELinux is turned on and off with two important configuration files,/etc/selinux/config and/boot/grub/menu.lst respectively, the two files need to be modified to turn off SELinux as follows:

[Email protected] ~]#cat/etc/selinux/Config# ThisFileControls 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  <==== change = number to Disabled# Selinuxtype                   =Can take one of these values:# targeted-targeted processes is protected,# MLS-Multi level Security protection. Selinuxtype=Targeted
[Email protected] ~]#Cat/boot/grub/menu.lst
# grub.conf generated by Anaconda
#
# Note that you don't have the to rerun grub after making changes to the This file
# notice:you has a/boot partition. This means
# all kernel and INITRD paths is relative to/boot/, eg.
# root (hd0,0)
# kernel/vmlinuz-version RO Root=/dev/sda5
# initrd/initrd-[generic-]version.img
#boot =/DEV/SDA
Default=0
Timeout=5
Splashimage= (hd0,0)/grub/splash.xpm.gz
Hiddenmenu
Title CentOS (2.6.32-279.el6.x86_64)
Root (hd0,0)
kernel/vmlinuz-2.6.32-279.el6.x86_64 ro root=uuid=edc1b124-6bc5-4dbe-b2d4-88805da96d4d Rd_NO_LUKS KEYBOARDTYPE=pc Keytable=us rd_no_md crashkernel=128m lang=zh_cn. UTF-8 RD_NO_LVM RD_NO_DM RHG
b quietselinux=0<====seliux=0 is added.
Initrd/initramfs-2.6.32-279.el6.x86_64.img
[Email protected] ~]#

Well, all the work has been done, now you can enjoy the connection. Use pleasant ^_^

SSH remote connection not on Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.