---
title: "How to create a sudo user on a Linux VPS | StreetHosting"
description: "Stop using root day to day: create a regular user, add it to the sudo group, copy your SSH key over and disable direct root login to cut your risk."
url: "https://streethosting.com.br/en/guides/vps/create-sudo-user-linux-vps"
type: "page"
language: "en-US"
---

VPS · 3 min · Intermediate

Published on Jun 17, 2026 · Updated on Jun 17, 2026

# How to create a sudo user on your VPS

Running as root all the time is risky: one wrong command affects everything. The best practice is to create a regular user with sudo and keep root for when you really need it.

By [Equipe StreetHosting](https://streethosting.com.br/en/autores#equipe-streethosting) · StreetHosting infrastructure and support team

[Linux administration](https://streethosting.com.br/en/guides/topics/linux) [Security and hardening](https://streethosting.com.br/en/guides/topics/security) [Getting started](https://streethosting.com.br/en/guides/topics/getting-started)

Summarize with:

[](https://chat.openai.com/?q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fcreate-sudo-user-linux-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "ChatGPT") [](https://claude.ai/new?q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fcreate-sudo-user-linux-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Claude") [](https://www.google.com/search?udm=50&aep=11&q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fcreate-sudo-user-linux-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Google AI Mode") [](https://x.com/i/grok?text=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fcreate-sudo-user-linux-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Grok") [](https://www.perplexity.ai/search/new?q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fcreate-sudo-user-linux-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Perplexity")

Share:

[](https://x.com/intent/tweet?text=How%20to%20create%20a%20sudo%20user%20on%20a%20Linux%20VPS&url=https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fcreate-sudo-user-linux-vps "Share on X") [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fcreate-sudo-user-linux-vps "Share on Facebook") [](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fcreate-sudo-user-linux-vps "Share on LinkedIn") [](https://wa.me/?text=How%20to%20create%20a%20sudo%20user%20on%20a%20Linux%20VPS%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fcreate-sudo-user-linux-vps "Share on WhatsApp")

For agents: Copy as Markdown [.md](https://streethosting.com.br/en/guides/vps/create-sudo-user-linux-vps.md)

In this guide 5 sections

* [Why not live as root](https://streethosting.com.br/en/guides/vps/create-sudo-user-linux-vps#por-que-nao-root)
* [Create the user](https://streethosting.com.br/en/guides/vps/create-sudo-user-linux-vps#criar-usuario)
* [Grant sudo and copy the key](https://streethosting.com.br/en/guides/vps/create-sudo-user-linux-vps#dar-sudo)
* [Block root login](https://streethosting.com.br/en/guides/vps/create-sudo-user-linux-vps#bloquear-root)
* [Safe routine](https://streethosting.com.br/en/guides/vps/create-sudo-user-linux-vps#rotina)

Quick answer

To stop using root, create a user with `adduser`, add it to the **sudo group**, copy your SSH key to the new account and block direct root login over SSH. Day to day, use the regular user and call sudo only when you need administrative power.

## Why not live as root[](https://streethosting.com.br/en/guides/vps/create-sudo-user-linux-vps#por-que-nao-root)

Root has no safety net. A mistyped command can delete system files without asking anything. On top of that, root is the user every attack tries to guess. Working as a regular user and calling sudo only when needed reduces accidents and makes break-ins harder. It is a pillar of [secure SSH](https://streethosting.com.br/en/guides/vps/secure-ssh-linux-vps).

## Create the user[](https://streethosting.com.br/en/guides/vps/create-sudo-user-linux-vps#criar-usuario)

1. Logged in as root, run `adduser username`.
2. Set a strong password for the new account.
3. Fill in the optional details or just confirm.

## Grant sudo and copy the key[](https://streethosting.com.br/en/guides/vps/create-sudo-user-linux-vps#dar-sudo)

Add the user to the sudo group to allow administrative commands. If you use key-based login, copy your public key to the new user's `authorized_keys`, as described in [passwordless SSH key](https://streethosting.com.br/en/guides/vps/passwordless-ssh-login-vps). Test logging in with the new account before moving on.

Always test the new user's login in a second window before touching root. That way, if something goes wrong, you still have the old session open to fix it.

## Block root login[](https://streethosting.com.br/en/guides/vps/create-sudo-user-linux-vps#bloquear-root)

Only disable root login after confirming that the new sudo user can log in and run administrative commands. Blocking it before testing can lock you out of the VPS.

Once the user is validated, turn off direct root login over SSH in the service configuration and restart it. Root still exists for sudo, but it stops being an exposed way in.

## Safe routine[](https://streethosting.com.br/en/guides/vps/create-sudo-user-linux-vps#rotina)

* Regular user for day-to-day work
* Sudo group for administrative actions
* SSH key copied to the new user
* Direct root login disabled and tested

This simple setup already puts your VPS at a much higher security level than the default. To pick the right machine for your services, compare the [VPS plans](https://streethosting.com.br/en/vps).

In this guide

* [Why not live as root](https://streethosting.com.br/en/guides/vps/create-sudo-user-linux-vps#por-que-nao-root)
* [Create the user](https://streethosting.com.br/en/guides/vps/create-sudo-user-linux-vps#criar-usuario)
* [Grant sudo and copy the key](https://streethosting.com.br/en/guides/vps/create-sudo-user-linux-vps#dar-sudo)
* [Block root login](https://streethosting.com.br/en/guides/vps/create-sudo-user-linux-vps#bloquear-root)
* [Safe routine](https://streethosting.com.br/en/guides/vps/create-sudo-user-linux-vps#rotina)

## Frequently asked questions

Why shouldn't I use root all the time?

Root can do anything, including wiping the system without warning. One wrong command or a malicious script can do total damage. A regular user with sudo asks for confirmation on administrative actions, which adds a layer of protection.

What is the sudo group?

It is the group that authorizes a user to run commands as an administrator using sudo. Members of that group type their own password and run privileged commands without having to become root all the time.

Do I need to copy the SSH key to the new user?

If you use key-based login, yes. The key has to be in the new user's authorized\_keys so you can log in without a password through that account. Without it, key login only works for the old user.

Is it safe to block root login?

Yes, as long as the new sudo user is tested and working. Blocking root over SSH is a standard security practice, because root is the number one target of brute-force attacks.

Next step

See VPS plans

Root VPS in Brazil with NVMe and Anti-DDoS.

[See VPS plans](https://streethosting.com.br/en/vps)

[See Ryzen VPS Ryzen 9 9950X VPS in São Paulo with root access, NVMe and gamer Anti-DDoS.](https://streethosting.com.br/en/vps/ryzen) [See Xeon VPS Xeon VPS for steady workloads, automation and long-running projects.](https://streethosting.com.br/en/vps/xeon)

## Related guides

[VPS Beginner How to connect to your VPS for the first time via SSH You bought the VPS and received an IP, a user and a password. Now it is time for the first login. Here is how to connect over SSH from any system and what to do in the first few minutes. 3 min Read guide](https://streethosting.com.br/en/guides/vps/connect-to-vps-via-ssh-first-time) [VPS Intermediate How to set up passwordless SSH key login on a VPS Key-based login is safer and easier than a password. You generate a key pair, copy the public key to the server, and log in without typing anything. Here is how, in a few steps. 3 min Read guide](https://streethosting.com.br/en/guides/vps/passwordless-ssh-login-vps) [VPS Intermediate How to secure SSH on a Linux VPS: keys, passwords, fail2ban SSH is usually the first target on any VPS with a public IP. This guide walks through a practical routine that cuts the risk without complicating your day: an ED25519 key, password-free login, admin access through sudo, blocking of automated attempts and a periodic review of authorized keys. 4 min Read guide](https://streethosting.com.br/en/guides/vps/secure-ssh-linux-vps)

[← Back to the Guide Center](https://streethosting.com.br/en/guides)
