Lesson 19 / 31
Groups & sudo
Organize users with groups, grant admin rights safely with sudo and edit sudoers only with visudo.
By Rahul Agarwal · 15 years in web development · Updated 1 Oct 2026
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.