可以在windows平台下使用putty連接遠程linux主機。
如果putty提示“Connection refused”,那麼可能是遠程主機沒有安裝OpenSSH。可以通過命令
# rpm -qa openssh
# rpm -qa openssh-server
查看是否安裝OpenSSH。如果沒有,需自行安裝。一般系統安裝盤中都有OpenSSH的安裝軟件包。
如果已經安裝了OpenSSH,那麼可能的原因就是沒有啟動SSH了。這時候的情況一般如下:
# /usr/sbin/sshd
系統提示“Could not load host key: /etc/ssh/ssh_host_key
Could not load host key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_dsa_key
Disabling protocol version 1. Could not load host key
Disabling protocol version 2. Could not load host key
sshd: no hostkeys available — exiting”
大致的意思就是需要某個key什麼的。
解決辦法如下:
#ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
Generating public/private dsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /etc/ssh/ssh_host_dsa_key.
Your public key has been saved in /etc/ssh/ssh_host_dsa_key.pub.
The key fingerprint is:
xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx [email protected]
#ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
Generating public/private rkey pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /etc/ssh/ssh_host_rsa_key.
Your public key has been saved in /etc/ssh/ssh_host_dsa_rey.pub.
#/usr/sbin/sshd
這時候,就可以在windows底下使用putty連接這台linux主機了。