#安裝ssh sudo apt-get install openssh-server openssh-client sudo apt-get update sudo apt-get upgrade
查看ssh是否啟動
ps -ef|grep ssh
如果沒啟動,執行啟動命令
/etc/init.d/ssh stop /etc/init.d/ssh start /etc/init.d/ssh restart
修改ssh配置文件
vim /etc/ssh/sshd_config
找到PermitRootLogin prohibit-password
改為PermitRootLogin yes
#測試ssh ssh localhost #22端口設為防火牆例外 sudo ufw allow 22/tcp #或者直接關閉防火牆 sudo ufw diable
如果重啟后沒有自動啟動,需要配置openssh-server開機自動啟動 :打開/etc/rc.local
文件,在exit 0
語句前加入 /etc/init.d/ssh start
下載安裝xshell,新建會話,主機中輸入ubuntu系統的ip地址,用戶名root及密碼,點擊連接,可以看到連接成功的提示: