Managing users and groups is crucial for Linux system administrators. Here’s a concise guide on creating a new user, a new group, and adding the user to the group using the command line.
Step 1: Open the Terminal
Access the terminal with Ctrl
+ Alt
+ T
or search for “Terminal” or “Konsole” in your system’s application menu.
Step 2: Create a New User
Create a new user by entering:
sudo adduser <username>
Replace <username>
with the desired username. Confirm the user creation by pressing Y
and Enter
.
Step 3: Create a New Group
Create a new group by entering:
sudo groupadd <groupname>
Replace <groupname>
with the desired group name.
Step 4: Add the User to the Group
Add the user to the group with:
sudo usermod -aG <groupname> <username>
Replace <groupname>
and <username>
with the appropriate values.
That’s it! You’ve created a new user and group, and added the user to the group in Linux. Remember to manage user accounts and group memberships to maintain a secure and organized system.