1.新建用户
adduser testuser                           //新建testuser 用户
passwd testuser                            //给testuser 用户设置密码
vim /etc/sudoers                           //修改配置文件
youuser ALL=(ALL) ALL
PS:要在root用户下
2.建工作组
groupadd testgroup                          //新建test工作组
3.新建用户同时增加工作组
useradd -g testgroup testuser               //新建testuser用户并增加到testgroup工作组
//注::-g 所属组 -d 家目录 -s 所用的SHELL
4.给已有的用户增加工作组
usermod -G groupname username
1. 临时关闭
在/etc/shadow文件中属于该用户的行的第二个字段(密码)前面加上*就可以了。想恢复该用户,去掉*即可
//或者使用如下命令关闭用户账号:
passwd testuser –l//重新释放:
passwd testuser –u
6.永久性删除用户账号
userdel testuser
userdel -R testuser
groupdel testgroup
usermod –G testgroup testuser 
 //(强制删除该用户的主目录和主目录下的所有文件和子目录)
7.显示用户信息
id user
cat /etc/passwd
补充
补充:查看用户和用户组的方法用户列表文件:/etc/passwd用户组列表文件:/etc/group查看系统中有哪些用户:cut -d : -f 1 /etc/passwd查看可以登录系统的用户:cat /etc/passwd | grep -v /sbin/nologin | cut -d : -f 1查看用户操作:w命令(需要root权限)查看某一用户:w 用户名查看登录用户:who查看用户登录历史记录:last
摘自[centos系统添加/删除用户和用户组的例子]
解决linux下sudo更改文件权限报错xxxis not in the sudoers file. This incident will be reported.
Linux中普通用户用sudo执行命令时
报”xxx is not in the sudoers file.This incident will be reported”错误,解决方法就是在/etc/sudoers文件里给该用户添加权限。如下:
1. 切换到root用户下
   方法为直接在命令行输入:su,然后输入密码(即你的登录密码,且密码默认不可见)。2./etc/sudoers文件默认是只读的,对root来说也是,因此需先添加sudoers文件的写权限,命令是:
 即执行操作:chmod u+w /etc/sudoers2. 编辑sudoers文件 
 即执行:vi /etc/sudoers
 找到这行 root ALL=(ALL) ALL,在他下面添加xxx ALL=(ALL) ALL (这里的xxx是你的用户名)3. ps:这里说下你可以sudoers添加下面四行中任意一条 
 youuser ALL=(ALL) ALL
 %youuser ALL=(ALL) ALL
 youuser ALL=(ALL) NOPASSWD: ALL
 %youuser ALL=(ALL) NOPASSWD: ALL4. 命令解释
第一行:允许用户youuser执行sudo命令(需要输入密码).
 第二行:允许用户组youuser里面的用户执行sudo命令(需要输入密码).
 第三行:允许用户youuser执行sudo命令,并且在执行的时候不输入密码.
 第四行:允许用户组youuser里面的用户执行sudo命令,并且在执行的时候不输入密码.4.撤销sudoers文件写权限,命令: 
 chmod u-w /etc/sudoers