Lesson 19 / 31

Groups & sudo

Organize users with groups, grant admin rights safely with sudo and edit sudoers only with visudo.

Groups

Groups let you grant the same permissions to many users at once. Add a user to a group with usermod -aG.

sudo groupadd devs
sudo usermod -aG devs bob
groups bob

Output:

bob : bob devs

sudo — temporary superpowers

sudo command runs one command as root, after you authenticate with your own password. It's safer than logging in as root all the time.

Handle /etc/sudoers carefully

Never edit /etc/sudoers directly — use visudo, which checks syntax before saving so you can't lock yourself out.