QR CookingNotes

CookingNotes

Your Personal Recipe Book

Get it on Google Play
QR FiNoteMe

FiNoteMe

Smart Finance Tracker

Get it on Google Play
linuxserver Managing users is one of the most essential tasks you must learn when working with Linux servers. Whether you're running a VPS, handling small projects, or preparing for DevOps, understanding how to add, remove, and manage users gives you full control of security and access.

How to Create and Manage Users on Linux Server (Beginner-Friendly Guide)

5 Min Read Verified Content
This beginner-friendly tutorial will guide you step-by-step using simple commands and clear explanations, perfect for anyone who is new to Linux server administration.

Welcome back to another easy and friendly Linux Server tutorial!
In this lesson, we’ll learn one of the most important things every server owner must know:

👉 How to create, manage, delete, and control users on a Linux system.

You don’t need to be a sysadmin.
You don’t need deep knowledge.
Just follow the steps calmly — even total beginners can do this.

Let’s begin!




🧩 Why User Management Matters in Linux

Linux is a multi-user system.
That means you can create different accounts for different people, apps, and services.

Reasons why user management is important:

  • Improves security

  • Controls what each user can access

  • Helps you organize your server

  • Prevents accidental damage by restricting permissions

  • Required for real DevOps or sysadmin work

If you're running a VPS (DigitalOcean, Linode, IDCloudHost, AWS, or anything), this tutorial is mandatory knowledge.




🧱 Step 1: Checking Your Current User

Before creating new users, let’s see who we are.

Run:

whoami

This will show your current logged-in user.

Most of the time on a newly installed server, you're using:

root

The root user is the most powerful account — so be careful!




👤 Step 2: How to Create a New User

To create a new user, run:

sudo adduser username

Example:

sudo adduser tommy

Linux will ask:

  • Full name

  • Phone number

  • Other info

You can just press ENTER through all of them.
This command automatically creates:

  • A home directory

  • Default shell

  • User folder permissions

Super easy! 🎉




🔐 Step 3: Set or Change Password for a User

To set a password:

sudo passwd username

Example:

sudo passwd tommy

Enter the new password twice.
Done!




⭐ Step 4: Give a User Sudo Access (Administrator Privileges)

If you want the new user to be able to run admin commands:

sudo usermod -aG sudo username

Example:

sudo usermod -aG sudo tommy

This adds the user to the sudo group, which means they can do administrative tasks.




📂 Step 5: How to Switch to Another User

Use:

su - username

Example:

su - tommy

Now you're logged in as that user.




🗑️ Step 6: How to Delete a User

To delete a user:

sudo deluser username

To delete the user and their home directory:

sudo deluser --remove-home username

Be very careful!
Deleting a user with --remove-home removes everything they own.




🔍 Step 7: List All Users on the System

You can check all system users:

cut -d: -f1 /etc/passwd

Or a cleaner list of human users:

awk -F':' '$3 >= 1000 {print $1}' /etc/passwd


📦 Step 8: Creating Groups

Groups help manage permissions.
To create a group:

sudo addgroup groupname

Example:

sudo addgroup developers


👥 Step 9: Add a User to a Group

sudo usermod -aG groupname username

Example:

sudo usermod -aG developers tommy


🚫 Step 10: Lock & Unlock a User Account

Lock account (disable login):

sudo usermod -L username

Unlock account:

sudo usermod -U username

Very useful if someone leaves your team.




💾 Bonus: View User Info

To check a user’s full info:

id username

To view their home folder:

ls -la /home/username


🔥 Conclusion

You’ve now mastered the essential user management commands on Linux:

✔ Add new users
✔ Set passwords
✔ Give sudo permissions
✔ Add/remove groups
✔ Delete users safely
✔ Lock/unlock accounts


This is core sysadmin knowledge, and you’re now one step closer to becoming a confident Linux server user.

If you're running a VPS or managing hosted services, these commands will be incredibly useful.


Advertisement
Back to Linuxserver