[Linux]Add/Delete sudoer/user on CentOS 8/REHL
Posted zZ
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Linux]Add/Delete sudoer/user on CentOS 8/REHL相关的知识,希望对你有一定的参考价值。
when normal user want to use admin privilledge, error message:
"
user is not in the sudoers file. This incident will be reported.
"
Add an existed user to sudoer:
1. gain root command line access:
su
2. add an existed user user1 to sudoers:
useradd -G wheel user1
3. re-logon to apply new settings:
su user1
4. test sudo permissions:
sudo whoami
--if all went well, below commadns are ‘root‘ output.
Add an non-exist user(newuser) to sudoer:
Step 1/2 the same
3. set password for new user:
passwd newuser
4. re-logon to apply new settings:
su user1
5. test sudo permissions:
sudo whoami
--if all went well, below commadns are ‘root‘ output.
- Take a note of the user and its username you wish to remove.
You can list all system users by using the belowcat
command:# cat /etc/passwd
- Use the
userdel
command to remove a user. In this example we will remove a user with usernameredhat-user
. Please note the-r
option instructs theuserdel
command to remove also user‘s home directory:# userdel -r redhat-user
- Use the
-f
option to force the user removal in case the user is logged:# userdel -f -r redhat-user
以上是关于[Linux]Add/Delete sudoer/user on CentOS 8/REHL的主要内容,如果未能解决你的问题,请参考以下文章
Linux课程笔记 Linux系统集权分治管理sudoer配置案例
Linux网络管理,NAT网络配置,修改主机名称,主机映射,防火墙,系统启动级别,用户和用户组,为用户配置sudoer权限,文件权限管理,打包和压缩
Linux网络管理,NAT网络配置,修改主机名称,主机映射,防火墙,系统启动级别,用户和用户组,为用户配置sudoer权限,文件权限管理,打包和压缩