Browse guides

Create an administrator user

Avoid daily work as root by using a named account with controlled sudo privileges.

Beginner7 min readUpdated July 18, 2026
1

Create the account

Sign in as root, then create a named account. Replace β€œalex” with your own username.

adduser alex
usermod -aG sudo alex
2

Authorize your SSH key

From your local computer, copy your public key to the new account. ssh-copy-id creates the correct permissions automatically.

ssh-copy-id [email protected]
3

Test the new access

Open a second terminal window and test the account before closing your current root session.

ssh [email protected]
sudo whoami

Keep the root session open

Only close it after sudo whoami returns β€œroot”. This gives you a recovery path.