Guide

Create a normal user with sudo on a new VPS

Last updated: 15 November 2026

Working as root all the time is risky: one typo can wreck the server. As a normal user you must put sudo in front of anything that changes the system and type your password, and every sudo command is logged. Do the steps in this order to avoid locking yourself out.

Fast VPS from $7.99 a month

See Fast VPS plansHow ordering works

1. Create the user

Debian and Ubuntu (run as root):

apt update && apt install -y sudo
adduser alice
usermod -aG sudo alice

AlmaLinux and Rocky (run as root):

useradd -m alice
passwd alice
usermod -aG wheel alice

Replace alice with the name you want and choose a strong password.

2. Test sudo

su - alice
sudo whoami

The second command should print root after you type alice's password. Type exit to go back.

3. Give the user your SSH key

From your own computer: ssh-copy-id alice@YOUR-IP. If password login is already off and your key works for root, copy the key on the server instead (as root):

install -d -m 700 -o alice -g alice /home/alice/.ssh
install -m 600 -o alice -g alice /root/.ssh/authorized_keys /home/alice/.ssh/authorized_keys

Then open a second terminal and check that ssh alice@YOUR-IP logs in with the key and that sudo whoami works. Details and the Windows PowerShell version are in the SSH keys guide.

4. Only then restrict root

When key login and sudo both work for the new user, follow step 4 of the SSH keys guide to turn off password login and, if you wish, root login over SSH. Keep your current session open until a new login works. If you lock yourself out, use the emergency console on your service page, if it shows one.

Related

First login · Firewall · Automatic updates · Fast VPS

Questions and answers

Why not just use root?
A typo as root can destroy the server, and nothing shows who did what. A normal user must type sudo and a password for system changes, and every sudo command is logged.

How do I give a user sudo rights?
On Debian and Ubuntu add the user to the sudo group (usermod -aG sudo NAME); on AlmaLinux and Rocky add it to the wheel group.

When can I turn off root login?
Only after key login and sudo both work for the new user, tested in a second terminal.

What if I lock myself out?
Use the emergency console on your service page, if it shows one, log in there and undo the change.

Ready to try it? Fast VPS from $7.99 a month

See Fast VPS plansHow ordering works