- root登录服务器,添加用户
adduser yang
- 添加密码
passwd yang
- 对创建的新用户进行sudo操作的授权
$:whereis sudoers
sudoers: /etc/sudoers /etc/sudoers.d /usr/share/man/man5/sudoers.5.gz
- 加入可写的权限
chmod -v u+w /etc/sudoers
- 将yang用户添加至sudoers文件中
vim /etc/sudoers
root ALL=(ALL) ALL
yang ALL=(ALL) ALL
- 将sudoers文件权限改回去
chmod -v u-w /etc/sudoers
2.root登录服务器,删除用户
userdel yang
groupdel testgroup
usermod –G testgroup yang //(强制删除该用户的主目录和主目录下的所有文件和子目录)