在Linux中如何将用户从sudo组中移除?

在linux组中移除用户操作命令

命令: gpasswd -d userName groupName

gpasswd -d 用户 sudo
login as: root
root@120.78.178.239's password:
Welcome to Ubuntu 18.04.2 LTS (GNU/Linux 4.15.0-48-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

 * Ubuntu's Kubernetes 1.14 distributions can bypass Docker and use containerd
   directly, see https://bit.ly/ubuntu-containerd or try it now with

     snap install microk8s --classic

 * Canonical Livepatch is available for installation.
   - Reduce system reboots and improve kernel security. Activate at:
     https://ubuntu.com/livepatch

Welcome to Alibaba Cloud Elastic Compute Service !

Last login: Wed Jun 26 16:22:15 2019 from 125.70.79.36
root@karat:~# clear
root@karat:~# id root
uid=0(root) gid=0(root) groups=0(root)
root@karat:~# id sun
uid=1000(sun) gid=1000(sun) groups=1000(sun),27(sudo)
root@karat:~# id aaron
uid=1002(aaron) gid=1002(aaron) groups=1002(aaron),27(sudo)
root@karat:~# id bill
uid=1001(bill) gid=1001(bill) grou


ps=1001(bill),27(sudo)
root@karat:~# id magento_user
uid=1004(magento_user) gid=1004(magento_user) groups=1004(magento_user),27(sudo)
root@karat:~# gpasswd -d magento_user sudo
Removing user magento_user from group sudo
root@karat:~# id magento_user
uid=1004(magento_user) gid=1004(magento_user) groups=1004(magento_user)
root@karat:~#

Leave a Reply

您的邮箱地址不会被公开。 必填项已用 * 标注