centos下啟用sshd服務
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
如此即可。