Docs / Server Management / How to Create a Non-Root User on Linux

How to Create a Non-Root User on Linux

By Admin · Feb 25, 2026 · Updated Apr 23, 2026 · 276 views · 1 min read

Running everything as root is a security risk. Create a regular user for day-to-day tasks.

Create User

adduser myuser

Enter a password and optional user information when prompted.

Grant Sudo Access

usermod -aG sudo myuser

On RHEL-based systems (AlmaLinux, Rocky), use the wheel group:

usermod -aG wheel myuser

Set Up SSH Key for New User

su - myuser
mkdir -p ~/.ssh
chmod 700 ~/.ssh
nano ~/.ssh/authorized_keys
# Paste your public key
chmod 600 ~/.ssh/authorized_keys

Test

ssh myuser@YOUR_IP_ADDRESS
sudo whoami  # Should output: root

Was this article helpful?