ssh遠程不到服務器,
不知道誰操作了什麼導致SSH啓動失敗,一直連接不上服務器,剛開始以爲系統壞了呢。
提示如圖:
Starting sshd:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0777 for '/etc/ssh/ssh_host_rsa_key' are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_rsa_key
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0777 for '/etc/ssh/ssh_host_dsa_key' are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: /etc/ssh/ssh_host_dsa_key
Could not load host key: /etc/ssh/ssh_host_dsa_key
Disabling protocol version 2. Could not load host key
sshd: no hostkeys available -- exiting.
[FAILED]
解決方法:
#chmod 600 sshd_config ssh_host_dsa_key ssh_host_key ssh_host_rsa_key
#chmod 620 moduli
#chmod 644 ssh_config ssh_host_dsa_key.pub ssh_host_key.pub ssh_host_rsa_key.pub
#service sshd start
再次出現如下錯誤:
[root@bailongjun ssh]# service sshd restart
Stopping sshd: [FAILED]
Starting sshd: /var/empty/sshd must be owned by root and not group or world-writable.
[FAILED]
在終端上直接登錄,問題顯示如下:
/var/empty/sshd must be owned by root and not group or world-writable.
問題:
Linux上的SSH無法啓動
報告/var/empty/sshd must be owned by root and not group or world-writable.
解決辦法:
首先通過物理終端進入到linux上,手工檢查ssh發現沒運行
# /etc/init.d/sshd status
sshd is stopped
手工啓動服務,發現報告權限錯誤。
# /etc/init.d/sshd start
Starting sshd:/var/empty/sshd must be owned by root and not group or world-writable.
[FAILED]
使用rpm -V 命令可檢查到ssh的軟件包正常,但某個目錄的屬主錯誤。
# rpm -V openssh-server
S.5..... c /etc/ssh/sshd_config
.....U.. /var/empty/sshd
經查看發現這個目錄的屬主不是root,所以啓動ssh報錯
# ls -ld /var/empty/sshd/
d--x--x--x 2 vu00106 root 1024 Feb 2 2005 /var/empty/sshd/
修改爲root屬主,啓動成功
# chown root /var/empty/sshd/
# /etc/init.d/sshd start
Starting sshd: [ OK ]
至此問題修復。
另外,還可以嘗試:
這個是權限的問題
可採取以下兩步解決
chown -R root.root /var/empty/sshd
chmod 744 /var/empty/sshd
service sshd restart
就可以解決上述的問題。