sudo和wheel用户组

介绍wheel用户组的用途

Posted by Cheney.Yin on June 25, 2022

sudo 和 wheel组

查看docker用户信息,

1
2
id docker
uid=1001(docker) gid=1001(docker) groups=1001(docker)

docker用户没有加入/etc/sudoers,因此sudo命令失败。

1
2
3
[docker@cheney-hp etc]$ sudo ip addr
[sudo] password for docker:
docker is not in the sudoers file.  This incident will be reported.

解决该问题有两种方式,一种是把docker加入/etc/sudoers,例如echo 'docker ALL=(ALL) ALL' >> /etc/sudoers,另一种方式是把docker加入wheel用户组。

1
sudo gpasswd -a docker wheel
1
2
3
4
5
6
7
8
[docker@cheney-hp etc]$ sudo ip addr
[sudo] password for docker:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever