Ubuntu 系統(tǒng)如何使用 root 用戶登錄實例?
Ubuntu 系統(tǒng)的默認(rèn)用戶名是 ubuntu,并在安裝過程中默認(rèn)不設(shè)置 root 帳戶和密碼。您如有需要,可在設(shè)置中開啟允許 root 用戶登錄。具體操作步驟如下:
1.使用 ubuntu 帳戶登錄輕量應(yīng)用服務(wù)器。
2.執(zhí)行以下命令,設(shè)置 root 密碼。
4.重復(fù)輸入 root 的密碼,按 Enter。
返回如下信息,即表示 root 密碼設(shè)置成功。
7.找到 #Authentication,將 PasswordAuthentication 參數(shù)修改為 yes。
說明:若 sshd_config 配置文件中無此配置項,則添加 PasswordAuthentication yes 項即可。
8.按 Esc,輸入 :wq,保存文件并返回。
9.執(zhí)行以下命令,重啟 ssh 服務(wù)。
用戶名:root
登錄密碼:在 步驟2 中已設(shè)置的密碼
1.使用 ubuntu 帳戶登錄輕量應(yīng)用服務(wù)器。
2.執(zhí)行以下命令,設(shè)置 root 密碼。
sudo passwd root
3.輸入 root 的密碼,按 Enter。4.重復(fù)輸入 root 的密碼,按 Enter。
返回如下信息,即表示 root 密碼設(shè)置成功。
passwd: password updated successfully
5.執(zhí)行以下命令,打開 sshd_config 配置文件。
sudo vi /etc/ssh/sshd_config
6.按 i 切換至編輯模式,找到 #Authentication,將 PermitRootLogin 參數(shù)修改為 yes。如果 PermitRootLogin 參數(shù)被注釋,請去掉首行的注釋符號(#)。7.找到 #Authentication,將 PasswordAuthentication 參數(shù)修改為 yes。
說明:若 sshd_config 配置文件中無此配置項,則添加 PasswordAuthentication yes 項即可。
8.按 Esc,輸入 :wq,保存文件并返回。
9.執(zhí)行以下命令,重啟 ssh 服務(wù)。
sudo service ssh restart
10.使用以下信息登錄 Ubuntu 輕量應(yīng)用服務(wù)器:用戶名:root
登錄密碼:在 步驟2 中已設(shè)置的密碼
信息科技 2022-11-01 22:02:50 通過 網(wǎng)頁 瀏覽(1291) 打印