5

I would like to know, why it is required to reboot, to apply the changes, which I made.

I refer to the use of

adduser username sudo

I use Ubuntu 12.04.1 LTS "Server".

0

3 Answers 3

8

You are not required to reboot the system but you have to log out and log in again. Group membership is evaluated at login time only.

If you are in a situation in which logging out and back in is inconvenient (for example, an SSH session) then you can just spawn a login subshell with su - <user> (or equivalently su -l <user> or su --login <user>) but it will work only in that subshell.
(thx to steeldriver for pointing this out).

0
1

In addition to the previous answers:

You may also "activate" a group in a given terminal by saying newgrp name_of_group.

An example:

% whoami
kindaro

% groups  # Where we start at.
shared nix wheel kindaro

% sudo usermod --append --groups audio kindaro  # Let us add a group membership.

% groups  # As you see, nothing changed yet.
shared nix wheel kindaro

% newgrp audio

% groups  # Now the change is in effect.
audio shared nix wheel kindaro

What this command does is create a new shell process over the one already running. If you do not wish to have a shell within a shell, you may execute exec newgrp ... instead.

0

to test, from your terminal call

id

which will show you your username and group, for your current login session. it's the only way to know for sure whether your change was correct. The output will be something like

uid=102(andrew) gid=101(users) groups=101(users),14(sysadmin)

Not the answer you're looking for? Browse other questions tagged .