分类: 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/
保存!!
#service sshd restart