添加新的管理员
- 假如想添加的新管理员用户叫abcd
adduser abcd
passwd abcd
然后输入密码 (密码简单了通不过)
系统提示输入确认密码后再输入一次。OK添加成功。
- 修改 /etc/sudoers 文件,找到这附近,在root下面添加一行,如下所示:
sudo vim /etc/sudoers
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
abcd ALL=(ALL) ALL
保存时需要使用:wq!就可以保存了。
禁止root远程登录
-
编辑/etc/ssh/sshd_config。
sudo vim /etc/ssh/sshd_config 找到 PermitRootLogin,大概在第35行
把#PermitRootLogin yes
改为PermitRootLogin no
-
执行
service sshd restart
重启服务