天天看點

Ubuntu18.04虛拟機設定ssh服務Ubuntu18.04虛拟機設定ssh服務

Ubuntu18.04虛拟機設定ssh服務

1.首先測試主機與虛拟機能否ping通,這是使用ssh服務的基礎

Ubuntu:ctrl+Alt+T打開terminal,輸入

ifconfig

檢視ip

Ubuntu18.04虛拟機設定ssh服務Ubuntu18.04虛拟機設定ssh服務

windows:win+R運作cmd,輸入

ping 192.168.142.130

,确認主機和虛拟機是否能夠聯通。

Ubuntu18.04虛拟機設定ssh服務Ubuntu18.04虛拟機設定ssh服務

虛拟機和主機之間可以聯通,進行下一步。

2.windos:下載下傳putty(推薦,個人認為比較好用)

Ubuntu安裝ssh服務:

終端運作

sudo ps -e |grep ssh

檢查是否已經安裝好ssh服務,未顯示sshd表示ssh服務未完成安裝

Ubuntu18.04虛拟機設定ssh服務Ubuntu18.04虛拟機設定ssh服務

安裝前先更新軟體清單

sudo apt-get update

Ubuntu18.04虛拟機設定ssh服務Ubuntu18.04虛拟機設定ssh服務

随後安裝ssh服務

sudo apt-get install openssh-server

若出現

E: 無法獲得鎖 /var/lib/dpkg/lock-frontend - open (11: 資源暫時不可用)

E: 無法擷取 dpkg 前端鎖 (/var/lib/dpkg/lock-frontend),是否有其他程序正占用它?

Ubuntu18.04虛拟機設定ssh服務Ubuntu18.04虛拟機設定ssh服務

參考關于Ubuntu系統中出現E: 無法獲得鎖 /var/lib/dpkg/lock-frontend - open (11: 資源暫時不可用) E: Unable to acquire the dpkg

再次輸入

sudo ps -e |grep ssh

檢視ssh服務是否安裝完成

出現了sshd則表示ssh服務安裝成功,否則檢查安裝步驟

Ubuntu18.04虛拟機設定ssh服務Ubuntu18.04虛拟機設定ssh服務

最後一步,關閉防火牆

service ufw stop

,輸入密碼驗證即可,然後就可以使用ssh對虛拟機進行連接配接了

Ubuntu18.04虛拟機設定ssh服務Ubuntu18.04虛拟機設定ssh服務

繼續閱讀