Server Management

How to Add and Manage Users on a Linux Server

How to Add and Manage Users on a Linux Server: A Guide by Vicservers

In today’s digital economy, managing user access on Linux servers is critical for ensuring security, efficiency, and scalability — especially for Nigerian businesses embracing digital transformation. At Vicservers, we specialize in providing secure, scalable, and reliable server solutions. In this blog, we walk you through the essential steps to add and manage users on a Linux server — whether you’re a system admin, DevOps engineer, or tech entrepreneur managing your own infrastructure.

Why User Management Matters

User management allows system administrators to:

  • Control who can access what on the server.
  • Assign proper permissions for operational safety.
  • Track usage and monitor activities.
  • Prevent unauthorized access and security breaches.

Let’s dive into the practical steps.

Step 1: Adding a New User

To add a new user to your Linux server, you can use either of the following:

🟩 Using adduser (Recommended for Simplicity)

sudo adduser john

This command will:

  • Create a new user.
  • Set up a home directory (/home/john).
  • Prompt you to set a password.

🟨 Using useradd (For Advanced Users)

sudo useradd -m -s /bin/bash john
sudo passwd john
  • -m creates a home directory.
  • -s defines the shell.

Step 2: Granting Admin (Sudo) Privileges

On Ubuntu/Debian-based systems:

sudo usermod -aG sudo john

On CentOS/RHEL systems:

sudo usermod -aG wheel john

This allows the user to run admin-level commands using sudo.

Step 3: Modifying User Information

You may need to rename a user, change their home directory, or update their group membership:

sudo usermod -l newname oldname       # Rename user
sudo usermod -d /new/home username    # Change home directory
sudo usermod -aG devops username      # Add to group

Step 4: Deleting Users

To remove a user:

sudo deluser username         # Ubuntu/Debian
sudo userdel username         # CentOS/Red Hat

To delete the user and their home directory:

sudo deluser --remove-home username
sudo userdel -r username

Step 5: Creating and Managing Groups

Linux groups help organize users and define access levels.

Create a group:

sudo groupadd developers

Add a user to a group:

sudo usermod -aG developers john

Remove a user from a group:

sudo gpasswd -d john developers

Step 6: Monitoring Users

Track who is logged in:

who

View activity:

w

Check login history:

last

This is especially useful for auditing and compliance — important for enterprise clients and cloud infrastructure teams.

Step 7: Locking or Disabling Accounts

Lock a user:

sudo passwd -l username

Unlock:

sudo passwd -u username

Disable login:

sudo usermod -s /usr/sbin/nologin username

Use this for suspending access without deleting user data.

Best Practices by Vicservers

At Vicservers, we recommend the following for all clients managing their Linux environments:

  • 🔐 Use SSH keys instead of passwords.
  • 📅 Set account expiration for contractors:
    sudo chage -E 2025-12-31 username
    
  • 🕵️ Regularly audit users and access logs.
  • 🔄 Automate user provisioning with Ansible or bash scripts.

 Final Thoughts

Linux user management is more than just creating accounts — it’s about maintaining a secure and organized environment. Whether you’re running cloud servers in Lagos, hosting websites for clients, or building fintech platforms, Vicservers has your back with managed services, security best practices, and professional support.

Need help managing your Linux infrastructure or migrating to a better server platform? Contact Vicservers or visit www.vicservers.com to learn more.

 

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button