1. 默認不帶ssh,所以需要安裝一下ssh
sudo apt install openssh-server
2 .設置root密碼,ubuntu默認root密碼是隨機的,需要重置一下
sudo passwd root
3. 允許root用戶登錄,編輯sshd_config
sudo vim /etc/ssh/sshd_config 找到# Authentication項下的 PermitRootLogin prohibit-password改成PermitRootLogin yes
4.最后當然是選擇原諒ubuntu啦,重啟ssh搞定
sudo systemctl restart sshd