Adding a new user
Overview
After you receive a dedicated server, you log in with the default account: root on Linux or Administrator on Windows. For daily work it is safer to create a separate user for each person who needs access. This way you can control who has administrator rights and remove access for a single person without changing the main password.
This guide shows how to add a user on Linux and on Windows Server, give it administrator rights and check that the login works.
Before you begin
You need:
- the server IP address and the default password from the client area (Orders, then your server, then Order Details);
- an SSH client for Linux or a Remote Desktop client for Windows;
- the name of the new user and a strong password for it.
Adding a user on Linux
Connect to the server over SSH as root:
Debian and Ubuntu
Create the user with the adduser command. It creates the home directory and asks you to set a password:
adduser username
Enter the password twice. The other fields (full name, phone and so on) are optional, press Enter to skip them.
To give the user administrator rights, add it to the sudo group:
usermod -aG sudo username
AlmaLinux, Rocky Linux and CentOS
Create the user and set a password:
useradd -m username passwd username
To give the user administrator rights, add it to the wheel group:
usermod -aG wheel username
Checking the new user
Switch to the new user and run a command with sudo:
su - username sudo whoami
Enter the password of the new user. If the output is root, the user has administrator rights. Type exit to return to the root session.
ssh-copy-id [email protected].
Adding a user on Windows Server
Connect to the server via Remote Desktop as Administrator.
Using Computer Management
- Open Server Manager and select Tools, then Computer Management.
- Go to System Tools, then Local Users and Groups, then Users.
- Right-click an empty area and select New User.
- Enter the user name and the password twice.
- Clear the User must change password at next logon checkbox if you want to set the final password yourself, or leave it selected so the user sets their own password.
- Click Create, then Close.
Giving access and rights
A new user cannot connect over Remote Desktop until you add it to a group:
- In Local Users and Groups, open Users and double-click the new user.
- Open the Member Of tab and click Add.
- Enter the group name and click OK:
- Remote Desktop Users, to allow Remote Desktop login without administrator rights;
- Administrators, to give full administrator rights. Members of this group can also connect over Remote Desktop.
- Click OK to save the changes.
Using PowerShell
You can do the same in PowerShell run as administrator:
$Password = Read-Host -AsSecureString New-LocalUser -Name "username" -Password $Password Add-LocalGroupMember -Group "Remote Desktop Users" -Member "username"
To give administrator rights, replace Remote Desktop Users with Administrators.
Checking the new user
Disconnect from the server and connect again via Remote Desktop with the new user name and password.
If the server is a domain controller, local users are not available. Create the user in Active Directory Users and Computers instead.
Removing access
When a person no longer needs access, remove their user:
- on Linux, run
userdel -r username(the-roption also deletes the home directory, so save any files you need first); - on Windows Server, open Local Users and Groups, then Users, right-click the user and select Delete.
Do not delete or disable the default root or Administrator account. If you lose access to all accounts, you will need the IP-KVM console to recover the server.