1. 程式人生 > >解除Ubuntu禁止root遠端登入

解除Ubuntu禁止root遠端登入

編輯SSH服務配置檔案

編輯SSH服務的配置檔案sshd_config,修改SSH的埠和root使用者許可權。

使用到的命令:(按字母 i 進入編輯模式,按ESC退出編輯模式, :wq 儲存退出)。

root@Jaking:~# vim /etc/ssh/sshd_config

1. 開放遠端埠

找到 # port 22所在的那一行,複製該行內容並修改。

將 #port 22 修改為 port 22(將前面的 # 去掉)。

該行內容為設定SSHD服務的埠號

2. 允許root遠端登入

找到 #PermitRootLogin prohibit-password那一行,複製該行內容並修改。

將 #PermitRootLogin prohibit-password 修改為 PermitRootLogin yes

3. 重啟ssh服務

service sshd restart 或者 /etc/init.d/ssh restart

本文原創地址:https://www.linuxprobe.com/relieve