一、在虛擬機中查看ip
二、啓動SSH服務
命令爲:
/etc/init.d/ssh start
或者
service ssh start
查看SSH服務狀態是否正常運行,命令爲:
/etc/init.d/ssh status
或者
service ssh status
三、生成兩個密鑰:
ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
ssh-keygen -t dsa -f /etc/ssh/ssh_host_rsa_key
修改ssh 配置文件
用Xshell root連接時顯示ssh服務器拒絕了密碼,應該是應該是sshd的設置不允許root用戶用密碼遠程登錄
修改 /etc/ssh/sshd_config文件,注意,安裝了openssh纔會有這個文件,如果文件不存在請檢查是否安裝了openssh。
vim /etc/ssh/sshd_config
1
找到
Authentication:
LoginGraceTime 120
PermitRootLogin prohibit-password
StrictModes yes
1
2
3
4
5
改成
Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes
1
2
3
4
然後輸入命令
/etc/init.d/ssh restart
1
重啓ssh服務即可。