Ubuntu 系統(tǒng)如何使用 root 用戶登錄實(shí)例?
Ubuntu 系統(tǒng)的默認(rèn)用戶名是 ubuntu,并在安裝過(guò)程中默認(rèn)不設(shè)置 root 帳戶和密碼。您如有需要,可在設(shè)置中開(kāi)啟允許 root 用戶登錄。具體操作步驟如下:
使用 ubuntu 帳戶登錄輕量應(yīng)用服務(wù)器。
-
執(zhí)行以下命令,設(shè)置 root 密碼。
sudo passwd root 輸入 root 的密碼,按 Enter。
-
重復(fù)輸入 root 的密碼,按 Enter。
返回如下信息,即表示 root 密碼設(shè)置成功。passwd: password updated successfully -
執(zhí)行以下命令,打開(kāi)
sshd_config配置文件。sudo vi /etc/ssh/sshd_config -
按 i 切換至編輯模式,找到
#Authentication,將PermitRootLogin參數(shù)修改為yes。如果PermitRootLogin參數(shù)被注釋,請(qǐng)去掉首行的注釋符號(hào)(#)。如下圖所示:
image -
找到
#Authentication,將PasswordAuthentication參數(shù)修改為 yes。如下圖所示:說(shuō)明
若
sshd_config配置文件中無(wú)此配置項(xiàng),則添加PasswordAuthentication yes項(xiàng)即可。image 按 Esc,輸入 :wq,保存文件并返回。
-
執(zhí)行以下命令,重啟 ssh 服務(wù)。
sudo service ssh restart

