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.
Terminal β as root
adduser alex
usermod -aG sudo alex2
Authorize your SSH key
From your local computer, copy your public key to the new account. ssh-copy-id creates the correct permissions automatically.
Terminal β local computer
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.
Terminal
ssh [email protected]
sudo whoamiKeep the root session open
Only close it after sudo whoami returns βrootβ. This gives you a recovery path.