远程连接工具是: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;
2、重启sshd服务
三、检查防火墙是否开启
如果防火墙是关闭的,则进行步骤4;如果防火墙没有关闭,则 永久性的关闭它,然后进行步骤4。
四、检查selinux是否开启
查看系统selinux目前的状态
如果结果也是"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的详细内容。