技術(shù)員聯(lián)盟提供win764位系統(tǒng)下載,win10,win7,xp,裝機(jī)純凈版,64位旗艦版,綠色軟件,免費(fèi)軟件下載基地!

當(dāng)前位置:主頁 > 教程 > 服務(wù)器類 >

SSH啟動失敗解決方法

來源:技術(shù)員聯(lián)盟┆發(fā)布時(shí)間:2018-12-26 06:04┆點(diǎn)擊:

  VPS是3個(gè)人合租共用的,不知道誰操作了什么導(dǎo)致SSH啟動失敗,一直連接不上剛開始以為系統(tǒng)壞了呢,后面通過VPS終端登陸上去發(fā)現(xiàn)SSH服務(wù)沒在運(yùn)行,于是嘗試運(yùn)行SSHD發(fā)現(xiàn)出現(xiàn)如下錯(cuò)誤:

  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

  再次出現(xiàn)如下錯(cuò)誤:

  [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無法啟動

  報(bào)告/var/empty/sshd must be owned by root and not group or world-writable.

  解決辦法:

  首先通過物理終端進(jìn)入到linux上,手工檢查ssh發(fā)現(xiàn)沒運(yùn)行

  -bash-2.05b# /etc/init.d/sshd status

  sshd is stopped

  手工啟動服務(wù),發(fā)現(xiàn)報(bào)告權(quán)限錯(cuò)誤。

  -bash-2.05b# /etc/init.d/sshd start

  Starting sshd:/var/empty/sshd must be owned by root and not group or world-writable.

  [FAILED]

  -bash-2.05b#

  使用rpm -V 命令可檢查到ssh的軟件包正常,但某個(gè)目錄的屬主錯(cuò)誤。

  -bash-2.05b# rpm -V openssh-server

  S.5….. c /etc/ssh/sshd_config

  …..U.. /var/empty/sshd

  -bash-2.05b#

  經(jīng)查看發(fā)現(xiàn)這個(gè)目錄的屬主不是root,所以啟動ssh報(bào)錯(cuò)

  -bash-2.05b# ls -ld /var/empty/sshd/

  d–x–x–x 2 vu00106 root 1024 Feb 2 2005 /var/empty/sshd/

  -bash-2.05b#

  修改為root屬主,啟動成功

  -bash-2.05b# chown root /var/empty/sshd/

  -bash-2.05b# /etc/init.d/sshd start

  Starting sshd: [ OK ]

  -bash-2.05b#

  至此問題修復(fù)。

  另外,還可以嘗試:

  這個(gè)是權(quán)限的問題

  可采取以下兩步解決

  chown -R root.root /var/empty/sshd

  chmod 744 /var/empty/sshd

  service sshd restart

  就可以解決上述的問題。