Quick answer
How do I create a sudo user on a VPS?
To create a sudo user on a VPS, run adduser with a new name, add it to the sudo group (wheel on AlmaLinux and Rocky Linux), copy root's SSH key to the new home folder and test a login. Then set PermitRootLogin no. A new SaltVPS server hands you root over SSH, so this takes 6 steps.
In brief
- Why: daily work as a normal user limits damage from typos and stolen sessions.
- Group:
sudoon Debian and Ubuntu,wheelon AlmaLinux and Rocky Linux. - Key: copy
/root/.ssh/authorized_keysto the new user, with the right owner. - Test first: log in as the new user in a second terminal before you touch root login.
- Then:
PermitRootLogin noin the SSH settings.
How do you create a sudo user on a Debian or Ubuntu VPS?
Logged in as root. Replace alice with the name you want.
Add the user
Run
adduser alice. Set a password; it is used for sudo, not for SSH. Press Enter through the name and phone questions.Grant sudo rights
Run
usermod -aG sudo alice. If the sudo command is missing on a minimal Debian image, runapt install sudofirst.Copy the SSH key
Run
rsync --archive --chown=alice:alice /root/.ssh /home/alice. The new user now accepts the same key as root.Test the login
From your computer, in a new terminal, run
ssh alice@your-ip, thensudo whoami. It should print root after your password.Turn off root login
In
/etc/ssh/sshd_config, setPermitRootLogin no. Check the file withsshd -t.Restart SSH
Run
systemctl restart ssh. Keep the old session open until a fresh login as alice works.
How do the commands differ between Linux systems?
The idea is the same everywhere; only the group and a few command names change.
| Task | Debian / Ubuntu | AlmaLinux / Rocky Linux |
|---|---|---|
| Create the user | adduser alice | useradd -m alice, then passwd alice |
| Grant admin rights | usermod -aG sudo alice | usermod -aG wheel alice |
| Copy the key | rsync --archive --chown=alice:alice /root/.ssh /home/alice | Same command |
| Restart SSH | systemctl restart ssh | systemctl restart sshd |
| Check group membership | groups alice | groups alice |
Why work as a sudo user instead of root?
sudo asks for a password and logs each admin command, while root runs everything silently. A wrong rm typed as root removes system files at once. As a normal user it fails until you add sudo, which gives a moment to think.
Turning off root login also means bots must guess a user name as well as a key. Combined with key-only access and Fail2ban, that removes most automated noise. The full order of steps is in the Linux VPS security guide.
What if the server was delivered with a password instead of a key?
Change the temporary root password first, then add a key to the new user. SaltVPS checked its server page on 16 November 2026: without a key at checkout, the team sets a temporary root password shown in the dashboard. Run passwd at once.
To add a key later, run mkdir -p /home/alice/.ssh, paste your public key into /home/alice/.ssh/authorized_keys, then chown -R alice:alice /home/alice/.ssh and chmod 700 /home/alice/.ssh. The first SSH login page shows how to create a key on your computer.
Can sudo skip the password?
Yes, but only do it for a key-only account. Run visudo -f /etc/sudoers.d/alice and add alice ALL=(ALL) NOPASSWD:ALL. Always edit sudo rules with visudo: it checks the syntax, and a broken sudoers file can block every admin command. On a KVM server with your own kernel, these files are yours alone.
Sudo user questions
What is the difference between adduser and useradd?
adduser is a friendly Debian script that creates the home folder and asks for a password. useradd is the low-level tool; add -m to create the home folder.
How do I create a sudo user on Ubuntu 24.04?
The same way as on any Debian-based system: adduser, then usermod -aG sudo. Ubuntu images already include sudo.
How do I remove sudo rights later?
Run gpasswd -d alice sudo, or gpasswd -d alice wheel on AlmaLinux and Rocky Linux.
Will turning off root login break anything?
Not for SSH users with sudo. Scripts or backup tools that log in as root need to use the new user and sudo instead.
Should every person get their own sudo user?
Yes. Separate accounts and keys let you remove one person without changing anyone else's access.
Verdict
- Creating a sudo user on a VPS takes adduser, one group and a copied key.
- Test the new login before you set PermitRootLogin no.
Sources (3)
- adduser(8) manual page — Debian (2026-11-16)
- sudoers(5) manual — Sudo project (2026-11-16)
- sshd_config(5) manual page — OpenBSD project (2026-11-16)
Get a server with root over SSH
Paste your public key at checkout, then create your sudo user in a few minutes.
- Built by a person, 1 hour at most after confirmation
- Lost days credited back if a server cannot be delivered
- Pay in BTC, XMR, USDT, USDC, ETH, SOL or LTC
- DomaineGoat LLC · Panama