VPS/VDS Hosting

Create a sudo user on a Linux VPS

Create a non-root administrator account with sudo and SSH keys to secure access to your Infrawire Linux VPS.

intermediate~1 min read

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 # should show: deploy sudo (or wheel on some 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@VPS_IP

Then log in: ssh deploy@VPS_IP

Test sudo

Bash
sudo apt update # or: sudo whoami → root

Infrawire offers a VPS for each major distribution: Ubuntu VPS, Debian VPS, AlmaLinux VPS, Rocky Linux VPS and Kali Linux VPS.

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! 🚀

Latest tutorials

Stay up to date with the latest offers, discounts and special promotions.

View promotions

We use cookies

We use cookies to measure and improve our site. Privacy policy