Linux System Administration Basics
Since Linux is a multi-user operating system, several people may be logged in and actively working on a given machine at the same time. Security-wise, it is never a good idea to allow users to share the credentials of the same account. In fact, best practices dictate the use of as many user accounts as people needing access to the machine.
At the same time, it is to be expected that two or more users may need to share access to certain system resources, such as directories and files. User and group management in Linux allows us to accomplish both objectives.
Add new users
It creates an user thisuser belonging to the group thisgroup and using /bin/bash as default shell. By default on ubuntu it's /bin/sh.
useradd -G thisgroup -s /bin/bash thisuser
Modify the password of an user named thisuser
passwd thisuser
Check password of thisuser on the user list
grep thisuser /etc/passwd
Modify the default shell of an user named thisuser
chsh -s /bin/bash thisuser
It displays the list of all users on the system
awk -F':' '{ print $1}' /etc/passwd
Add new groups to an user
It creates a group thisgroup
groupadd thisgroup
It defines premiergroup as the primary group of user thisuser
usermod -g premiergroup thisuser 
It defines secondgroup as a supplementary group of user thisuser
usermod -a -G secondgroup thisuser
It displays members of the group thisgroup
getent group thisgroup
It displays the list of all groups on the system
cut -d: -f1 /etc/group | sort
Grant sudo privileges to an user
It adds the user thisuser to the sudo group. Members of this group can execute any command as root via sudo and prompted to authenticate themselves with their password when using sudo
usermod -a -G sudo thisuser
delete Users and groups
It deletes an user called thisuser
deluser thisuser
It delete a group called thisgroup
groupdel thisgroup
References
Learning the bash Shell: Unix Shell Programming
Cameron Newham and Bill Rosenblatt
O'Reilly Media, 1995. ISBN‑13: 978-0596009656
Relevant Tags
About the Author
Latest Articles
- 
      
        Research Tax CreditThe Research Activities Tax Credit is a tax credit that incentivizes private companies to increase their Research and Development (R&D). Within my company, I have been tasked with writing the Research Tax Credit (CIR) justification report for France. Here, the method for writing such a report.OCT 2025 · PIERRE-EDOUARD GUERIN
- 
      
        Turing Complete: From Logical Gates to CPU ArchitectureIn 2021, LevelHead published Turing Complete, a game about computer science. My friend Christophe Georgescu recommended me to play it. Unfortunately, I took his advice and now I can not stop to play this game! The game challenges you to design an entire computer from scratch. You start with basic logic gates, then move on to components, memory, CPU architecture, and finally assembly programming. By the way, the game is neat and present all these concepts in a playful and intuitive way.SEP 2025 · PIERRE-EDOUARD GUERIN
- 
      
        How to Manage a Project?In any company, every task is part of a project. I am responsible for managing multiple projects each year. I have to present deliverables to stakeholders, meet deadlines, allocate mandays and coordinate everyone’s actions. This is a meticulous work that requires a strong methodology.JUN 2025 · PIERRE-EDOUARD GUERIN
