Guide to Centos Installation and Root Access on CloudStack

Introduction After installing the Centos operating system on CloudStack, you usually log in with the username centos. However, in some cases, root access may be required. This guide explains step-by-step how to log in to the system with the centos user, obtain root access, and optionally create a password for the root user.

Step-by-Step Guide

  1. Log in with the Centos User:

    • Connect to the Centos server you created in the CloudStack console using SSH or VNC.
    • Log in using the username centos and your password.
  2. Root Access with the Sudo Command:

    • Run the following command in the terminal:
      Bash

      sudo -s
      
    • This command gives you root privileges. You can now run commands as the root user.
  3. Create a Root Password (Optional):

    • Why Create a Root Password: For security reasons, it’s important to create a password for the root user. This prevents unauthorized access to the root account.
    • Create Password:
      Bash

      passwd
      

      This command will prompt you to enter a new password. Make sure you create a strong password.

  4. Direct Login with the Root User (Optional):

    • SSH Configuration:
      • Open the SSH configuration file:
        Bash

        nano /etc/ssh/sshd_config
        
      • Find the following line and change the value to yes:
        PermitRootLogin yes
        
      • Save the file by pressing Ctrl+X, then Y, and Enter.
      • Restart the SSH service:
        Bash

        systemctl restart sshd
        
    • You can now log in directly to the system using the root username and the new password you created.

Important Notes:

  • Security: Be careful with root privileges. Incorrect commands can crash your system.
  • Sudoers File: If you have multiple users on your system, you can edit the sudoers file to define which users can run which commands.
  • SSH Key: We recommend using SSH keys for a more secure login.
  • Strong Password: Create a strong and unique password for the root user.