How to apply changes of newly added user groups without needing to reboot?
Local solution: use su yourself
to login again. In the new session you'll be considered as a member of the group.
Man pages for newgrp
and sg
might also be of interest to change your current group id (and login into a new group):
To use
webdev
's group id (and privileges) in your current shell use:newgrp webdev
To start a command with some group id (and keep current privileges in your shell) use:
sg webdev -c "command"
(
sg
is likesu
but for groups, and it should work without the group password if you are listed as a member of the group in the system's data)
Rebooting system is an overkill, even logout & login is not necessary if you use gpasswd
.
You can add takpar
to webdev
group using:
$ gpasswd -a takpar webdev
You can check group membership using getent group {name}
command:
$ getent group webdev
webdev:x:1008:webdev,takpar
which should be the same as cat /etc/group | grep webdev
. For completeness here's id
output from from takpar
shell session:
$ id takpar
uid=1007(takpar) gid=1007(takpar) groups=1007(takpar),1008(webdev)