EUR
european

EUR

usa

USD

Ex. VAT Ex. VAT 0%

Adding a new user on a VPS

A new VPS comes with one account: root on Linux or Administrator on Windows Server. Working under this account all the time is risky: any mistake runs with full rights, and the account name is known to everyone who scans the internet for open SSH or RDP ports. A separate user for everyday work, with administrator rights only when needed, is safer. It is also the way to give access to a colleague without sharing your own password.

Linux: create a user

Connect to the server over SSH as root. The commands differ slightly between distributions.

On Ubuntu and Debian, run:

adduser username

Replace username with the name of the new user. The command creates the home directory, asks for a password twice and then for optional details such as the full name. You can skip the details by pressing Enter.

On AlmaLinux and Rocky Linux, create the user and then set the password:

useradd -m username passwd username

Linux: give the user administrator rights

A new user has no administrator rights. To let it run commands as root with sudo, add it to the administrators group.

On Ubuntu and Debian, the group is sudo:

usermod -aG sudo username

On AlmaLinux and Rocky Linux, the group is wheel:

usermod -aG wheel username

Do not add the user to this group if it only needs to work with its own files, for example a colleague who uploads website content.

Linux: check the new user

Do not close the root session yet. Open a second terminal and connect as the new user:

ssh username@SERVER_IP

Check that sudo works:

sudo whoami

Enter the password of the new user. If the command returns root, the user has administrator rights. How to work with sudo is described in more detail in the manual "Obtaining root access when not provided by default".

Linux: set up SSH key login

Key-based login is more secure than a password. Run the following commands on your own computer, not on the server.

If you do not have a key yet, create one:

ssh-keygen -t ed25519

On Linux and macOS, copy the key to the server:

ssh-copy-id username@SERVER_IP

On Windows, ssh-copy-id is not available. Show the public key in PowerShell and copy the output:

type $env:USERPROFILE\.ssh\id_ed25519.pub

Then connect to the server as the new user and add the key:

mkdir -p ~/.ssh chmod 700 ~/.ssh nano ~/.ssh/authorized_keys

Paste the key on a new line, save the file and set its permissions:

chmod 600 ~/.ssh/authorized_keys

Connect again from your computer. If the server does not ask for the user password, key login works.

Linux: disable SSH login as root

When the new user can log in and use sudo, you can forbid direct SSH login as root. Open the SSH server configuration:

sudo nano /etc/ssh/sshd_config

Find the PermitRootLogin line, remove the # at its beginning if there is one, and set:

PermitRootLogin no

Restart the SSH service. On Ubuntu and Debian:

sudo systemctl restart ssh

On AlmaLinux and Rocky Linux:

sudo systemctl restart sshd

Warning

Change this setting only after you have checked that the new user can log in and run sudo. Keep your current session open and test the login in a new terminal. If you lose access, use the IP-KVM console (the REQUEST button in Order Details) to fix the configuration.

Windows Server: create a user

Connect to the server over RDP as Administrator.

To create a user in the graphical interface, press Win + R, enter lusrmgr.msc and press Enter. Open Users, right-click an empty area and select New User. Enter the user name and the password twice, clear User must change password at next logon if you set the final password yourself, and click Create.

You can also create a user in Command Prompt run as administrator:

net user username * /add

The command asks for the password twice.

Windows Server: give the user access

A new user cannot connect over RDP by default. Add it to one of the groups.

To give the user full administrator rights:

net localgroup Administrators username /add

To allow RDP access without administrator rights:

net localgroup "Remote Desktop Users" username /add

In the graphical interface, open the user in lusrmgr.msc, go to the Member Of tab, click Add and enter the group name.

Connect over RDP as the new user to check access before you change anything for the Administrator account.

If you lose access

If you can no longer log in as any user, request IP-KVM access with the REQUEST button in Order Details and fix the settings from the server console. If that does not help, create a support ticket and specify your VPS.

Changing the password of the default account is described in the manual "Changing the default user password".

VAT

  • Other

    Ex. VAT

    0%
  • austria

    Austria

    20%
  • Belgium

    Belgium

    21%
  • Bulgaria

    Bulgaria

    20%
  • Croatia

    Croatia

    25%
  • Cyprus

    Cyprus

    19%
  • Czech Republic

    Czech Republic

    21%
  • Denmark

    Denmark

    25%
  • Estonia

    Estonia

    22%
  • France

    France

    20%
  • Finland

    Finland

    24%
  • Germany

    Germany

    19%
  • Greece

    Greece

    24%
  • Hungary

    Hungary

    27%
  • Ireland

    Ireland

    23%
  • Italy

    Italy

    22%
  • Latvia

    Latvia

    21%
  • Lithuania

    Lithuania

    21%
  • Luxembourg

    Luxembourg

    17%
  • Malta

    Malta

    18%
  • Netherlands

    Netherlands

    21%
  • Poland

    Poland

    23%
  • Portugal

    Portugal

    23%
  • Romania

    Romania

    19%
  • Slovakia

    Slovakia

    20%
  • Slovenia

    Slovenia

    22%
  • Spain

    Spain

    21%
  • Sweden

    Sweden

    25%
  • USA

    USA

    0%
european
states
  • kingdom
  • germany
  • Español
  • French
  • Hrvatska
  • Italiano
  • Poland
  • Slovenski
  • ukraine
  • Türkçe
  • Русский
  • Other
  • Austria
  • Belgium
  • Bulgaria
  • Croatia
  • Cyprus
  • Czech Republic
  • Denmark
  • Estonia
  • Finland
  • France
  • Germany
  • Greece
  • Hungary
  • Ireland
  • Italy
  • Latvia
  • Lithuania
  • Luxembourg
  • Malta
  • Netherlands
  • Poland
  • Portugal
  • Romania
  • Slovakia
  • Slovenia
  • Spain
  • Sweden
  • USA