1.靜止root賬號登陸。
$
vi
/etc/ssh/sshd
.conf (
ssh
服務的配置文件,直接修改)
----------------------------------
PermitRootLogin no ( 找到這一行,並將其改爲 no )
---------------------------------------
保存退出
$ systemctl restart sshd (重啓一下sshd服務)
2、創建用戶並授權
$ adduser jeff (創建用戶jeff)
$
passwd
jeff (創建jeff的密碼)
$
chmod
-
v
u+w
/etc/sudoers
(增加 sudoers 文件的寫的權限,默認爲只讀)
$
vi
/etc/sudoers
(修改 sudoers)
-------------------------------------------------------
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
jeff ALL=(ALL) ALL (添加這一行)
3、$
chmod
-
v
u-w
/etc/sudoers
(刪除 sudoers 的寫的權限)
好了,現在賬號已經創建好了,使用jeff賬號登陸後,在命令前加 sudo 則是使用root權限了。第一次使用會彈出一些提示信息,正常現象。