您的位置 首页 技术

ssh无法远程连接linux

远程连接工具是:Xmanager Enterprise 5–>Xshell linux 发行版本是:CentOS-6.3-x86_64 解决方法如下: (在线学习…

远程连接工具是:Xmanager Enterprise 5–>Xshell

linux 发行版本是:CentOS-6.3-x86_64

解决方法如下:

(在线学习视频教程分享:linux视频教程)

一、查看网络配置文件中的IP有没有改变

先查看IPADDR有没有改变,要是没有被改变,那么继续步骤2;要是发生了改变则将IPADDR改成之前的,然后进行步骤2。

[root@fanycb ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0DEVICE="eth0"BOOTPROTO=noneNM_CONTROLLED="yes"ONBOOT="yes"TYPE="Ethernet"UUID="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 ~]#

二、检查sshd服务的状态以及端口是否正常

1、查看sshd的22端口是否处于正常的LISTEN状态,如果正常,则进行步骤3;如果不正常,则重新启动sshd服务,然后进行步骤3;

7a06e78d581144a3a266013199456a8.png

2、重启sshd服务

240225cbb3760b5ee0a9f3389477f06.png

三、检查防火墙是否开启

如果防火墙是关闭的,则进行步骤4;如果防火墙没有关闭,则 永久性的关闭它,然后进行步骤4。

7ae890884e74a77439527d60057e022.png

四、检查SELinux是否开启

查看系统SELinux目前的状态

ec9407116869ab70e2c996cec2cef37.png

如果结果也是"disabled",那么一切的检查就ok了,那就可以连接了。

可如果结果是"Enforcing"或者"permissive",说明系统上的SELinux是开启的,需要将它关闭。

因为SELinux的开启与关闭和两个重要的配置文件有关,分别是/etc/selinux/config和/boot/grub/menu.lst,所以要关闭SELinux就需要修改这两个文件,方法如下所示:

[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                       <====将=号后改为disabled# SELINUXTYPE= can take one of these two values:#     targeted - Targeted processes are protected,#     mls - Multi Level Security protection.SELINUXTYPE=targeted [root@fanycb ~]# cat /boot/grub/menu.lst # grub.conf generated by anaconda## Note that you do not have to rerun grub after making changes to this file# NOTICE:  You have a /boot partition.  This means that#          all kernel and initrd paths are relative to /boot/, eg.#          root (hd0,0)#          kernel /vmlinuz-version ro root=/dev/sda5#          initrd /initrd-[generic-]version.img#boot=/dev/sdadefault=0timeout=5splashimage=(hd0,0)/grub/splash.xpm.gzhiddenmenutitle 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.UTF-8 rd_NO_LVM rd_NO_DM rhgb quiet selinux=0                     <====seliux=0 是添加上去的 initrd /initramfs-2.6.32-279.el6.x86_64.img[root@fanycb ~]#

完成!

相关文章教程推荐:linux教程

以上就是ssh无法远程连接linux的详细内容,更多请关注24课堂在线网其它相关文章!

本文来自网络,不代表24小时课堂在线立场,转载请注明出处:https://www.24ketang.cn/27173.html

为您推荐

返回顶部