ssh: connect to host 192.168.57.131 port 22: Conne

文档背景:

重新克隆了一台centos机器,由于时间太久,已经忘了之前Xshell远程连接是如何配置的了。只记得,需要关闭防火墙。现将步骤整理如下:

操作步骤:

1、关闭防火墙

#查看防火墙状态

/etc/init.d/iptables status

#关闭防火墙

service iptables stop

2、xshell中telnet主机

Xshell:\> telnet 192.168.57.131 22


Connecting to 192.168.57.131:22...
Could not connect to '192.168.57.131' (port 22): Connection failed.

Type `help' to learn how to use Xshell prompt.

3、xshell中ping主机

Xshell:\> ping 192.168.57.131

正在 Ping 192.168.57.131 具有 32 字节的数据:
来自 192.168.57.131 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.57.131 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.57.131 的回复: 字节=32 时间<1ms TTL=64

4、主机中ssh本主机IP

ssh 192.168.57.131

5、查看22端口是否开启

[root@localhost Desktop]# netstat -nutlp | grep 22
[root@localhost Desktop]# /etc/init.d/sshd status
openssh-daemon is stopped

6、启动sshd

[root@localhost Desktop]# /etc/init.d/sshd start
Generating SSH1 RSA host key:                              [  OK  ]
Generating SSH2 RSA host key:                              [  OK  ]
Generating SSH2 DSA host key:                              [  OK  ]
Starting sshd:                                             [  OK  ]
[root@localhost Desktop]# netstat -nutlp | grep sshd
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      2951/sshd           
tcp        0      0 :::22                       :::*                        LISTEN      2951/sshd

7、重新连接Xshell

成功。

8、开机自启动sshd

chkconfig sshd on



你可能感兴趣的:(ssh: connect to host 192.168.57.131 port 22: Conne)