How to Manage Users on Linux VPS - Evoxt
Login
Register
We care about the Environment

How to Manage Users on Linux VPS

Managing users on a Linux VPS is crucial for maintaining security and effective access control. This guide explains how to create, secure, and manage user accounts on common distributions used with Evoxt VPS. Use the sections below for quick, distro-specific commands and best practices.

What is Linux User Management?

  • Create and control access for multiple users
  • Improve server security by assigning limited permissions
  • Enable team collaboration
  • Isolate application environments

1. Create a New User

Ubuntu / Debian:
sudo adduser USERNAME
adduser prompts you to set a password and basic info.

AlmaLinux / Rocky / RHEL:
sudo useradd -m -s /bin/bash USERNAME
sudo passwd USERNAME
This creates a home directory and sets the login shell, then lets you set the password.


2. Grant or Remove Sudo (Admin) Privileges

Ubuntu / Debian :
#add to sudo group
sudo usermod -aG sudo USERNAME

# remove from sudo group
sudo deluser USERNAME sudo

AlmaLinux / Rocky / RHEL:
# add to wheel group
sudo usermod -aG wheel USERNAME

# remove from wheel group
sudo gpasswd -d USERNAME wheel


3. Set or Change a User Password

sudo passwd USERNAME

4. Lock or Unlock a User

Lock (disable login):
sudo passwd -l USERNAME
Unlock:
sudo passwd -u USERNAME

5. Delete a User

Delete user only (keep files):
sudo userdel USERNAME
Delete user and home directory:
sudo userdel -r USERNAME

6. List Users & Groups

List all local users:
cut -d: -f1 /etc/passwd

List groups for a user:
groups USERNAME

Optional: Use SSH Key Authentication (Recommended)

SSH keys provide stronger, passwordless authentication. Generate keys locally and add the public key to ~/.ssh/authorized_keys on the server. See our guide: How to Set Up SSH Keys on Linux.

Quick Commands Cheat Sheet

# Create (Debian/Ubuntu)
sudo adduser USERNAME

# Create (RHEL-family)
sudo useradd -m -s /bin/bash USERNAME
sudo passwd USERNAME

# Grant sudo (Debian/Ubuntu)
sudo usermod -aG sudo USERNAME

# Grant sudo (RHEL-family)
sudo usermod -aG wheel USERNAME

# Remove sudo (Debian/Ubuntu)
sudo deluser USERNAME sudo

# Remove sudo (RHEL-family)
sudo gpasswd -d USERNAME wheel

# Lock / Unlock
sudo passwd -l USERNAME
sudo passwd -u USERNAME

# Delete
sudo userdel USERNAME
sudo userdel -r USERNAME

# List users
cut -d: -f1 /etc/passwd

# List groups for a user
groups USERNAME

Best Practices & Notes

  • Create a non-root admin account and disable direct root SSH login when possible.
  • Prefer SSH keys over passwords for server access.
  • Whitelist your admin IP to avoid accidental lockout when you apply restrictive controls.
  • Regularly review group memberships and remove unused accounts.

Need Help?

If you need assistance, please open a support ticket or browse our Evoxt VPS Tutorials for more guides.

High CPU Frequency Virtual Machines

Available Globally

Starting at

$2.99

Deploy now