Resetting the root password on a VPS

If you've lost access to the root password on a Linux server and can't log in through VNC, you can reset the root password using a recovery method. Here are the steps you should follow:

Step 1: Reboot into Recovery Mode

  1. Stop or Reboot the Server:
    • Shut down or reboot your server through the hosting provider's control panel. In some cases, you may need to request technical support for access to the recovery console.

Step 2: Connect to the Recovery Console

  1. Use a VNC Client:
    • Connect to the recovery console provided by your hosting provider using a VNC client. This may require a special link or instructions from the service provider.

Step 3: Mount the Root Filesystem

  1. Mount the Filesystem:
    • Once connected to the recovery console, mount the root filesystem. Typically, this can be done with the following command (the device name might differ):
      bash
      mount /dev/sda1 /mnt

Step 4: Change Root Directory

  1. Change Root Directory:
    • Use the chroot command to change the root directory to the mounted filesystem:
      bash
      chroot /mnt

Step 5: Reset the Root Password

  1. Use the passwd Command:
    • Reset the root password using the following command:
      bash
      passwd root
    • The system will prompt you to enter a new password twice. Enter and confirm the new password.

Step 6: Reboot the Server

  1. Exit and Reboot:
    • Exit the recovery mode and reboot the server to apply the new root credentials:
      bash
      exit reboot

Notes

  • Ensure you use this method only if there is no other way to regain access to the server.
  • After successfully resetting the password, update your security settings and ensure the new password is secure.
  • These steps may vary depending on your hosting provider and server configuration. If you encounter difficulties or have questions, contact your service provider’s technical support or consult a qualified system administrator.
  • vps, root, debian
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Корпоративная почта на базе собственного домена

Корпоративная почта на собственном домене не только придаёт профессиональный...

Установка и настройка Rclone

Rclone — это мощный инструмент командной строки для управления файлами на облачных хранилищах....

Apache vs Nginx: what’s the difference, how to Install, and which one to choose?

When choosing a web server for your project, Apache and Nginx often come into focus. Both of...

HTTP Errors: common causes and how to fix them

Error 403: ForbiddenDescription: The server understands the request but refuses to fulfill it....

Let's Encrypt without a control panel

Let's Encrypt SSL Certificates: How to Install and Set Up Free Automated Encryption Let's...

Powered by WHMCompleteSolution