Chinaunix首页 | 论坛 | 博客
  • 博客访问: 60382
  • 博文数量: 5
  • 博客积分: 301
  • 博客等级: 二等列兵
  • 技术积分: 70
  • 用 户 组: 普通用户
  • 注册时间: 2011-07-24 19:53
文章分类

全部博文(5)

文章存档

2012年(1)

2011年(4)

分类: LINUX

2011-12-08 20:25:17

使用PUTTY时出现Network error: Contection refused的解决方法

                  Note:前提条件主机和虚拟机相互ping通

一,按照如下步骤填写,例如:我的PC主机的IP是192.168.1.10,虚拟机IP是192.168.1.25

那么输入主机地址时,应填写的是虚拟机的IP,协议端口号一般选择22,具体原因接下来讲。

第4步是保存你目前的设置,可随意取名如:set,然后保存。

二,查看/etc/ssh/sshd_config ,正确设置如下:

红色标记重点查看

port 22

Protocol 1,2
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
.。。。。。。。。。。

。。。。。。。。。。。


#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6

。。。。。。

。。。。。。。

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication no
#PermitEmptyPasswords yes
PasswordAuthentication yes
。。。。。。。。。。

。。。。。。。。。。

# GSSAPI options
#GSSAPIAuthentication no
GSSAPIAuthentication yes
#GSSAPICleanupCredentials yes
GSSAPICleanupCredentials yes

。。。。。。。。

。。。。。。。。

# "PermitRootLogin without-password". If you just want the PAM account and
# session checks to run without PAM authentication, then enable this but set
# ChallengeResponseAuthentication=no
#UsePAM no
UsePAM yes

保存!!

三,查看/etc/hosts.deny和/etc/hosts.allow正确设置如下

#
# hosts.deny    This file describes the names of the hosts which are
#               *not* allowed to use the local INET services, as decided
#               by the '/usr/sbin/tcpd' server.
#
# The portmap line is redundant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow.  In particular
# you should know that NFS uses portmap!
in.sshd: ALL


保存!

#
# hosts.allow   This file describes the names of the hosts which are
#               allowed to use the local INET services, as decided
#               by the '/usr/sbin/tcpd' server.
in.sshd: 192.168.1.25        /虚拟机的IP/

保存!!

四,重启SSH服务,登陆putty

#service sshd restart

 

 

阅读(16133) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~