No KYC · seven Linux VPS plans, one price in six cities · Pay in BTC, USDT, USDC, ETH, SOL, LTC, XMR
Language: English
Configure a VPS

Guide · user accounts · checked 16 November 2026

How do I create a sudo user on a VPS?

Last updated: · 4 min read

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: sudo on Debian and Ubuntu, wheel on AlmaLinux and Rocky Linux.
  • Key: copy /root/.ssh/authorized_keys to 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 no in 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.

  1. 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.

  2. Grant sudo rights

    Run usermod -aG sudo alice. If the sudo command is missing on a minimal Debian image, run apt install sudo first.

  3. Copy the SSH key

    Run rsync --archive --chown=alice:alice /root/.ssh /home/alice. The new user now accepts the same key as root.

  4. Test the login

    From your computer, in a new terminal, run ssh alice@your-ip, then sudo whoami. It should print root after your password.

  5. Turn off root login

    In /etc/ssh/sshd_config, set PermitRootLogin no. Check the file with sshd -t.

  6. 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.

Commands to create a sudo user on Debian or Ubuntu and on AlmaLinux or Rocky Linux
TaskDebian / UbuntuAlmaLinux / Rocky Linux
Create the useradduser aliceuseradd -m alice, then passwd alice
Grant admin rightsusermod -aG sudo aliceusermod -aG wheel alice
Copy the keyrsync --archive --chown=alice:alice /root/.ssh /home/aliceSame command
Restart SSHsystemctl restart sshsystemctl restart sshd
Check group membershipgroups alicegroups 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)
  1. adduser(8) manual page — Debian (2026-11-16)
  2. sudoers(5) manual — Sudo project (2026-11-16)
  3. 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.

From $2.25/mo on 12 months · no KYC

Configure