如何将用户添加到“sudo”组?

cof*_*der 217 sudo user-management groups

/etc/sudoers我看到这个:

# Allow members of group sudo to execute any command after they have
# provided their password
# (Note that later entries override this, so you might need to move
# it further down)
%sudo ALL=(ALL) ALL
Run Code Online (Sandbox Code Playgroud)

那么如何将用户添加到该sudo组?

mac*_*aco 286

sudo usermod -aG sudo <username>
Run Code Online (Sandbox Code Playgroud)

a是非常重要的。没有它,他们将从所有其他组中删除。您需要重新启动 shell/终端或注销并重新登录才能生效。

也可以看看:


txw*_*ger 49

您可以使用用户管理 GUI(与您创建用户的位置相同),也可以sudo adduser <username> sudo在命令行中使用。

  • +1:这是将用户添加到群组的最容易记住、最简单和直观的方式! (9认同)
  • [RootSudo](https://help.ubuntu.com/community/RootSudo) 的 ubuntu 文档中也提到了这一点,尽管它们指的是 admin 组而不是 sudo 组 (2认同)

qbi*_*qbi 23

您还可以使用图形界面。单击面板右上角的齿轮,然后选择“系统设置”,然后选择“用户帐户”

您需要单击小解锁按钮才能在此窗口中编辑内容。然后单击此人的帐户并为“帐户类型”选择适当的下拉菜单

在此处输入图片说明


Bru*_*ira 21

如果您使用 Unity 作为桌面环境,这真的很简单。

如果您已经创建了一个用户,那么您可以简单地将其从Standard更改为Administrator,否则请确保在创建新用户时选择了Administrator

在尝试更改之前不要忘记解锁

在此处输入图片说明

  • 非常酷的 GIF 动画!+1 你是怎么做到的?将问题移至 [此处](http://askubuntu.com/questions/234217/how-to-do-gif-animations-for-instructions-and-learning-purposes-over-gui/234219#234219)。 (2认同)