1、useradd test 建用户test
2、passwd test 修改密码
3、vi /etc/sudoers 让用户具有root权限,修改这个文件,默认是只读的
4、如果不能修改让文件能够写 chmod u+w /etc/sudoers
5、在文件里了找到## Allow root to run any commands anywhere
加入如下内容:
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
test ALL=(ALL) ALL #加入的内容,让test具有root权限
6、按ESC退出键
7、输入 wq 回车,保存修改
后续使用者加上sudo 命令 就可以具有root权限了,会提示输入密码
centos新建用户获得root权限
最新推荐文章于 2024-04-15 02:43:59 发布