码迷,mamicode.com
首页 > 系统相关 > 详细

[Linux]Add/Delete sudoer/user on CentOS 8/REHL

时间:2020-03-08 09:37:53      阅读:84      评论:0      收藏:0      [点我收藏+]

标签:miss   sys   exist   comm   centos   bsp   lease   when   settings   

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.

  1. Take a note of the user and its username you wish to remove.

    You can list all system users by using the below cat command:
    # cat /etc/passwd
    
  2. Use the userdel command to remove a user. In this example we will remove a user with username redhat-user. Please note the -r option instructs the userdel command to remove also user‘s home directory:
    # userdel -r redhat-user
    
  3. 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

标签:miss   sys   exist   comm   centos   bsp   lease   when   settings   

原文地址:https://www.cnblogs.com/zienzir/p/12440294.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!