I use Debian 12 and want to add a user bob to sudoers. While logged in as bob, I ran su root
command to become root. As a root, I added bob to the sudo group using the following command:
sudo usermod -aG sudo bob
Right after that I inspected /etc/sudoers
file, which had the following line: %sudo ALL=(ALL:ALL) ALL
, which signifies that everybody who has sudo group has access to sudo
.
However, when I exited the root shell issuing exit
command and, therefore, returned to bob's shell, I was not able to use sudo
as if bob still was not in the sudoers file: user not in sudoers.
. Moreover, when I ran id
command, bob did not have the sudo group. I tried to close the terminal and to log in / log out, but it did not work. It was required to reboot the machine so that bob had access to sudo
.
Was there a way to not reboot the machine?
sudo usermod
command as root, as bob or as another user? Was bob already logged in? How did you log into bob's shell?sudo usermod
as root. I logged in as root usingsu root
command while being logged in as bob. I logged into bob's shell just by opening up my terminal (bob is my account).su root
. It's an important difference