Managing users is one of the fundamental tasks when working with Linux.
Whether you’re setting up a server, managing a team, or just organizing your personal system, knowing how to add, modify, and remove users is essential.
Let’s walk through the basics in a straightforward and easy-to-follow way.

Table of Contents


Understanding Users in Linux

Linux is built to support multiple users, each with their own environment and permissions. Here are the main types of users:

Root: The superuser with full control over the system
Regular users: Standard accounts for everyday use
System users: Special accounts used by system services,
usually without login access


Viewing Users and Current Logins

To see all users on your system, you can check the /etc/passwd file:

cat /etc/passwd

Image description

To find out who’s currently logged in:
Who

Image description


Creating a New User

Adding a user is simple. You can use:

useradd (a quick way to create a user):

Image description

sudo useradd username

Image description

  • Change password of the user sudo passwd username

Image description

adduser (more interactive, especially on Debian/Ubuntu):

Image description

sudo adduser username
This command will guide you through setting a password and other details

Image description


Modifying User Accounts

Sometimes you need to update user settings:

  • Change a user’s home directory:

sudo usermod -d /new/home username

Image description

Add a user to a group (for example, the profilers group):

sudo usermod -aG sudo username

Image description

Change the default shell:

sudo usermod -s /bin/bash username

Image description


Deleting Users

When a user no longer needs access, you can remove their account:

  • Delete the user but keep their files:

sudo userdel username

Image description

  • Delete the user and their home directory:

sudo userdel -r username

Image description


Working with Groups

Groups help manage permissions for multiple users at once.

  • Create a new group:

sudo groupadd groupname

Image description

  • Add a user to a group:

sudo usermod -aG groupname username

Image description


Managing Permissions

Linux permissions control who can read, write, or execute files.

  • Change permissions:

chmod u+x filename

Image description

  • Change ownership:

sudo chown username:groupname filename

Image description


Best Practices for User Management

• Only give users the permissions they need
• Use groups to simplify permission management
• Encourage strong passwords and regular updates
• Regularly review user accounts and remove those no longer
needed
• Keep backups of important data


Conclusion

User management in Linux is straightforward once you get familiar with the key commands and concepts. With these tools, you can keep your system organized, secure, and running smoothly. Take your time exploring, and you’ll soon feel confident managing users like a pro.