Get a VPS now!

InfrawireInfrawire LogoDocumentation
Appeler

Create a sudo user on a Linux VPS

Logging in only as root is convenient but risky. This guide shows how to create a dedicated user with sudo and SSH key access — a great complement to Secure SSH and UFW.

📋 Prerequisites

  • A Linux VPS (Ubuntu/Debian) with root or sudo access and an active SSH session.

Create the user

Replace deploy with your preferred username:

Bash
sudo adduser deploy sudo usermod -aG sudo deploy

Add to the sudo group

Bash
sudo groups deploy # doit afficher : deploy sudo (ou wheel sur certaines distros)

Set up an SSH key

On your PC, generate a key if needed (ssh-keygen -t ed25519). Then copy it to the server (as root, or as the new user once sudo works):

Bash
ssh-copy-id deploy@IP_DU_VPS

Puis connectez-vous : ssh deploy@IP_DU_VPS

Test sudo

Bash
sudo apt update # ou : sudo whoami → root

Best practices

  • Disable root password login after testing (see Secure SSH).
  • Keep the SSH port allowed in UFW.
  • Use strong passwords if you keep password authentication as a fallback.

Happy deploying! 🚀

Need help?

Questions about this guide? Our team and community are here to help.

Our team is available 24/7 to help you · Join our community