Centos7 创建用户并赋予sudo权限

1.创建用户

useradd test01

2.为用户创建创建密码

passwd test01

3.为普通用户赋予sudo权限

① 使用root用户登录系统,首先修改文件/etc/sudoers的写权限(默认为只读,增加写的权限)
  `chmod 640 /etc/sudoers`
② 使用vim编辑文件/etc/sudoers
  `vim /etc/sudoers`
③ 在root后面增加用户名和ALL
  `## Allow root to run any commands anywhere
  root    ALL=(ALL)       ALL
  test01    ALL=(ALL)       ALL
  `
④ wq保存,并将/etc/sudoers改为只读
 `chmod 440 /etc/sudoers`
原文地址:https://www.cnblogs.com/youmeng/p/14183166.html