sudo apt-get install openssh-server
啟動ssh服務
sudo /etc/init.d/ssh start
設置開機自啟動
sudo systemctl enable ssh
關閉ssh開機自動啟動命令
sudo systemctl disable ssh
單次開啟ssh
sudo systemctl start ssh
單次關閉ssh
sudo systemctl stop ssh
設置好后重啟
reboot
如果安裝openssh-server失敗,提示依賴錯誤的問題時
如:Unable to correct problems, you have held broken packages.
解決方法:
使用aptitude安裝可以自動的解決依賴問題
apt install aptitude
aptitude install openssh-server
#aptitude安裝過程會給出很多中解決方案,安裝過程會提示Y/N/q 如果默認的方案解決不了可以摁N換一個方案