[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Debian 10 64bit



Hello,

On Sun, Dec 20, 2020 at 11:32:33AM +0000, mick crane wrote:
> I noticed that if you add yourself to sudo group in /etc/group you
> have to logout and log back in for it to be noticed.

If you don't want to log out of the shell you can do this:

$ exec sg sudo "newgrp $(id -ng)"

The "exec" causes what follows to replace the current shell. Without
this you'd end up with two extra shells running and would have to
"exit" three times to close them.

"sg sudo" causes the following command to be executed with primary
group of "sudo".

"newgrp $(id -ng)" puts you back in your original primary group,
leaving you with group "sudo" as an additional group.

You can just do "newgroup sudo" but this:

- starts an extra shell so you'd have to "exit" it twice

- leaves you with "sudo" as your primary group

You can just do "su - $USER" but this will ask you for your
password.

Cheers,
Andy

-- 
https://bitfolk.com/ -- No-nonsense VPS hosting


Reply to: