[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:su2. add an existed user user1 to sudoers:useradd -G wheel user13. re-logon to apply new settings:su user14. 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 same3. set password for new user:passwd newuser
4. re-logon to apply new settings:su user15. 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
相关推荐
changecan 2020-11-19
ECSHOP专属建设 2020-11-13
88427810 2020-11-02
步知道 2020-10-27
Junzizhiai 2020-10-10
jackalwb 2020-10-05
小网管 2020-09-03
shiwenqiang 2020-09-14
85251846 2020-09-14
summerinsist 2020-08-21
87901735 2020-08-19
PinkBean 2020-08-11
85407718 2020-08-09
MichelinMessi 2020-07-30
suosuo 2020-07-28
CARBON 2020-07-28
lizhengfa 2020-07-27
88427810 2020-07-26