Manage users on cloud instances
Once you’ve created a new cloud instance and connected via SSH, you can move to the next step and create users.
This article covers the basics of user management on a Linux instance, created from one of our public images. This includes creating a new user, as well as setting a password for the default user.
Note: This does not cover advanced user privilege configurations, as this falls within your responsibility to self-manage and configure your cloud.
Add users to the instance
As best practice, you should create users and configure their credentials and permissions as needed. Logging in as the default user is not recommended.
Steps
-
1
-
2Type in the following command to switch to the root user:
sudo su
-
3Run the following command to add the user:
On Ubuntu or Debian:
adduser username
On CentOS or AlmaLinux:
adduser -m username
- Replace username with the desired username for your new user (exclude any spaces or special characters).
Note: The (-m) flag creates the user’s home directory, which is not required on Ubuntu and Debian.
-
4Next, set the user’s password by running the following command:
passwd username
- Replace username with the user you created in the previous step.
-
5You will be prompted to enter and confirm a password for the new user. Follow the instructions on the screen.
-
6
Set a password for the default user
As a security measure the password for the default (root) user is disabled.
The default user has full root privileges on the instance, and password-based root logins are more vulnerable to brute force attacks.
Users should rather get temporary root access when tasks require it (for example, using the ‘sudo’ command). This ensures that user activity is tracked and can be monitored.
Following the principle of least privilege, it is recommended to:
- Remove or disable the default user account.
- Add users with relevant permissions.
If you wish to retain the default user you will need to set a password for this user.
Steps
-
1
-
2Type in the following command to switch to the root user:
sudo su
-
3Run the following command to update the password:
passwd <username>
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
- username is the instance default username.
-
4You can now log into the instance console in the xneelo Cloud dashboard as the root user.
If you are having trouble connecting to your instance you can follow our guides on how to troubleshoot cloud instance connection.