Overview
This article explains how to create a non-root user on your VPS after it has been provisioned.
These steps apply to Ubuntu and Debian. Other Linux distributions may use different commands.
Background
When you originally provisioned your VPS, it was created with a root user. Creating a non-root user is useful if you need a separate user who does not have sudo access to the server.
Creating the new user
The following steps create a new non-root user.
In the following example, the new user is named newuser. You can use a different name, but it must follow the rules in the FAQ section below.
Log in to your VPS with either the SSH root password or SSH Key you originally configured. See Configuring and connecting to a VPS for more information.
Run the following command to create a user named
newuser.[server]$ sudo adduser newuser
The server prompts you to enter a password for the new user.
Enter a password for the new user, then enter it again to confirm.
The terminal does not display the characters as you type.Press
Enterto skip each of the remaining prompts for Full Name, Room Number, Work Phone, Home Phone, and Other.When asked whether the information is correct, press
Enterto confirm. This creates the new user.
Test the new user
Log out of your current root user session by typing
exit.Log in using
newuserand its password. You can locate the IP address in your panel.[local~]$ ssh newuser@your-server-ip
Enter the password when prompted.
Type in
whoamiand you should see the new username.[server]$ whoami newuser
FAQs
Does the new user have root access?
No. The adduser command creates a standard user, and the steps in this article do not grant root privileges.
Can I use a name other than newuser?
Yes. You can use any username that follows the server’s default naming rules. In general, a username must start with a lowercase letter and contain only lowercase letters, numbers, hyphens, and underscores, up to 32 characters.
See also
DreamHost links