Introduction: This tutorial explains how to access a Linux server using SSH with an alternate username, gain root access, and change the root password. We'll use the popular SSH client, PuTTY, for this demonstration.

Prerequisites: Before you begin, ensure you have the following:

  1. Server IP address or hostname.
  2. An alternate username with SSH access and administrative privileges.
  3. PuTTY installed on your local machine.

Steps to Access and Change Root Password:

Step 1: Open PuTTY

  • Launch PuTTY on your local machine, you can follow this article here.

Step 2: Configure PuTTY Session

  • In the PuTTY Configuration window:
    • Enter the server's IP address or hostname in the "Host Name (or IP address)" field.
    • Ensure that the SSH protocol is selected.
    • Enter a name for your saved session in the "Saved Sessions" field.
    • Click "Save" to save your session settings for future use.

Step 3: Connect to the Server

  • Click "Open" to initiate the SSH connection.

Step 4: Enter Username and Password

  • You will be prompted to enter your alternate username and password.
  • Enter the username and press "Enter."
  • Then, enter the password associated with the username and press "Enter."

Step 5: Gain Root Access

  • After successfully logging in with your alternate username, use the following command to switch to the root user:
    sudo -i
  • You will be prompted to enter the password for your alternate username once again.
  • After successfully logging in with your non-root username, you may need to gain administrative privileges to change the user's password. You can use the following command to switch to a superuser (e.g., sudo):
    sudo su

Step 6: Change Root Password

  • To change the root password, simply enter the following command and follow the prompts:
    passwd
  • You will be prompted to enter and confirm the new root password.

Step 7: Logout

  • After changing the root password, you can log out from the root session:
    bash
    exit

Step 8: Securely Store the Root Password

  • Ensure that you securely store the new root password, as it is a critical security credential.

Conclusion: You have successfully accessed the Linux server using an alternate username, gained root access, and changed the root password via SSH using PuTTY. Make sure to use this method responsibly and keep your credentials secure.

Byla tato odpověď nápomocná? 459 Uživatelům pomohlo (502 Hlasů)