1.添加用户
adduser test
设置密码
passwd test
2.添加root权限
(1):
chmod 755 /etc/sudoers
vi /etc/sudoers
文件,找到下面一行,把前面的注释(#)去掉
Allows people in group wheel to run all commands
%wheel ALL=(ALL) ALL
然后修改用户,使其属于root组(wheel),命令如下:
usermod -g root test
修改完毕,现在可以用tommy帐号登录,然后用命令 su – ,即可获得root权限进行操作。
将sudoers权限改回原状
chmod 440 /etc/sudoers
(2)
在/etc/sudoers中添加
test ALL=(ALL) ALL
Allow root to run any commands anywhere
root ALL=(ALL) ALL
test ALL=(ALL) ALL
3.关闭root登陆
编辑配置文件
vi /etc/ssh/sshd_config
修改
PermitRootLogin后面的yes为no,
并且去掉前面的注释符,同时可以限制失败次数
以上