Lesson 18 / 29

Groups & sudo

Organizing users, and granting admin rights safely.

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.