版权声明:学习中。。。 https://blog.csdn.net/fangdengfu123/article/details/82453576
添加用户:
adduser testusername
设置初始密码:
passwd testusername
# 根据系统提示设置
New password: (enter your password)
BAD PASSWORD: The password contains the user name in some form
Retype new password: (retype password)
给新用户添加sudo使用权限:
# 查找配置文件
whereis sudoers
# 查看文件权限
ls -l /etc/sudoers
# 添加写权限(原本只读)
chmod -v u+w /etc/sudoers
# 编辑配置文件,添加用户
vim /etc/sudoers
## Allow root to run any commands anywher
root ALL=(ALL) ALL
testuser ALL=(ALL) ALL #这个是新增的用户
# 退出编辑后,将文件权限恢复
chmod -v u-w /etc/sudoers
删除用户:
userdel testuser