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

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; once you’ve added new users, you can remove the default user (see next section).

    Steps

    1. 1
      Connect to your instance using SSH – see steps.
    2. 2
      Type in the following command to switch to the root user:

      sudo su
      1. 3
        Run 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.

      1. 4
        Next, set the user’s password by running the following command:

        passwd username
        • Replace username with the user you created in the previous step.
        1. 5
          You will be prompted to enter and confirm a password for the new user. Follow the instructions on the screen.
        1. 6
          Give the user administrative privileges (optional):

        This will allow the user to run commands as root using sudo.

        On Ubuntu or Debian:

            usermod -aG sudo username

            On CentOS or AlmaLinux:

                usermod -aG wheel username

                You can now log into the instance console in the xneelo Cloud dashboard as this user.





              • Remove a user from the instance

                Once you’ve added new user accounts with the correct permissions, you may want to remove the default user or any other account that is no longer needed. This helps improve your instance’s security.

                Steps

                1. 1
                  Connect to your instance using SSH – see steps.
                2. 2
                  Type in the following command to switch to the root user:

                sudo su
                1. 3
                  Check the current users on the system:
                cat /etc/passwd 

                1. 4
                  Run the following command to delete the user:

                On Ubuntu or Debian:

                deluser username

                On CentOS or AlmaLinux:

                userdel username
                1. 5
                  To also remove the user’s home directory and files, use the following command instead:

                On Ubuntu or Debian:

                deluser --remove-home username 

                On CentOS or AlmaLinux:

                userdel -r username
                1. 6
                  Verify the user has been removed:

                      getent passwd username





                      • Set a password for the default user

                        As a security measure the password for the default (root) user is disabled. See more on the default username and password of cloud instances.

                        If you wish to retain the default user, you will need to set a password for this user.

                        Steps

                        1. 1
                          Connect to your instance using SSH – see steps.
                        2. 2
                          Switch to the root user:

                            sudo su
                            1. 3
                              Update the password:
                            passwd <username>
                            
                            Enter new UNIX password:
                            Retype new UNIX password:
                            passwd: password updated successfully
                            

                            1. 4
                              You can now log into the instance console in the xneelo Cloud dashboard as the root user.



                          Assist Note

                          If you are having trouble connecting to your instance you can follow our guides on how to troubleshoot cloud instance connection.