# How do I create a sudo user on a VPS?

> How to create a sudo user on a VPS in 6 steps: add the user, grant sudo or wheel, copy your SSH key, test, then turn off root login.

- URL: https://saltvps.com/guides/how-to-create-a-sudo-user-on-a-vps/
- Last updated: 2026-11-16
- Publisher: SaltVPS (https://saltvps.com)

**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*

| 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](https://saltvps.com/guides/how-to-install-fail2ban-on-a-vps/ "How do I install Fail2ban on a VPS?"), that removes most automated noise. The full order of steps is in the [Linux VPS security guide](https://saltvps.com/guides/how-to-secure-a-linux-vps/ "How do I secure a Linux VPS?").

## 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](https://saltvps.com/help/first-ssh-login/ "How do I log in to a SaltVPS server over SSH?") 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](https://saltvps.com/what-is-a-kvm-vps/ "What is a KVM VPS?") 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

1. [adduser(8) manual page](https://manpages.debian.org/trixie/adduser/adduser.8.en.html) — Debian (2026-11-16)
2. [sudoers(5) manual](https://www.sudo.ws/docs/man/sudoers.man/) — Sudo project (2026-11-16)
3. [sshd_config(5) manual page](https://man.openbsd.org/sshd_config) — 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. [Order Grain for 12 months](https://saltvps.com/app/checkout/?plan=grain&term=12m&from=guides-how-to-create-a-sudo-user-on-a-vps&lang=en) · [All guides](https://saltvps.com/guides/ "Which VPS guides and Linux tutorials does SaltVPS publish?")

---

SaltVPS: SaltVPS sells Linux KVM VPS in New York, Dallas, Los Angeles, London, Amsterdam and Frankfurt, paid in crypto with no ID document. Seven plans from 2 to 32 GB of RAM cost the same in all six cities, and on the 12-month term each is priced at least 25% under a named comparable plan of a no-KYC crypto host, read on 16 November 2026. The operator is DomaineGoat LLC, Panama.
