ssh localhost
错误信息为:ssh: connect to host localhost port 22: Connection refused
这种错误很主要的一个原因是sshd服务没有启动,先启动sshd服务后就没有问题了
www.2cto.com
1、查卡服务是否启用
ps -ef | grep ssh
2、如果没有启用 则要安装
yum install openssh-server
3、安装完之后开启
/etc/init.d/sshd start
如果/etc/init.d/sshd start出现:
Generating SSH1 RSA host key: [FAILED]
www.2cto.com
解决办法:
$ yum search openssh
$ sudo yum install openssh
$ sudo sshd service start
sshd re-exec requires execution with an absolute path
[honki@localhost ~]$ sudo service sshd start
Generating SSH1 RSA host key: [ OK ]
Generating SSH2 RSA host key: [ OK ]
Generating SSH2 DSA host key: [ OK ]
Starting sshd: [ OK ]
4、如果还是连不上 关闭防火墙
/etc/init.d/iptables stop