putty 連接linux失敗---解決方案

在VMware中安裝Ubuntu之後,主機可以ping通虛擬機,想用putty來連接,結果返回: Authentication refused。

 

如下爲解決方案:

  1.在Ubuntu上查看ssh服務是否開啓, ps -ef|grep ssh

  2.發現沒有開啓ssh,試圖開啓ssh, service ssh start(無法開啓ssh,因爲沒有安裝ssh server 和 client)

  3.獲取ssh server和client 安裝包,apt update(返回很多404錯誤,說明有很多網址無法打開)

  4.在網絡上搜尋可用的源列表(source.list 位置爲:/etc/apt/sources.list),例如163的源列表

      
deb http://mirrors.163.com/ubuntu/ quantal main universe restricted multiverse
deb-src http://mirrors.163.com/ubuntu/ quantal main universe restricted multiverse
deb http://mirrors.163.com/ubuntu/ quantal-security universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ quantal-security universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ quantal-updates universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ quantal-proposed universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ quantal-proposed universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ quantal-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ quantal-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ quantal-updates universe main multiverse restricted
   爲原來的sources.list做備份,然後更新源列表,做 update(apt update),仍然發現很多404錯誤(這是因爲源列 表的目錄已經更改,即quantal目錄已經不存在)

  5.進入http://mirrors.163.com/ubuntu/dists 查看發現quantal已經不再存在,而lucid目錄存在(如下圖所示),並且有與quantal對應的文件和目錄,將source.list中quantal全部替換爲lucid。

   6.做update(apt update)

   7.安裝ssh server和client, sudo apt-get install openssh-server;sudo apt-get install openssh-client

   8.開啓ssh服務, etc/init.d/ssh start

   9.查看ssh服務狀態  ps -ef|grep ssh,發現進程已起

  10.putty 連接Ubuntu成功

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章