Password change/reset on Linux servers¶
In this article
Note
The connection via IP KVM is used to recover a password on a dedicated server. On a virtual server - Virt-viewer. The password reset steps vary depending on the installed operating system.
Information
A detailed description of remote control methods is located here.
CentOS¶
o reset or change the password on the server, perform the following steps. Points 1-5 apply only for virtual servers:
- Go to the Console tab of the service Invapi control panel;
-
Press the
Launch VNC consolebutton: -
Enter the PIN code:
-
Click on the downloaded file
console.vv
; -
In the opened console, click on the Keyboard icon in the upper left corner and select Ctrl+Alt+Delete from the list of options:
-
The server will be rebooted. If this turns off the console, you need to re-open it through the
Launch VNC console. button. As soon as booting from disk starts and a list of kernels available for booting appears for a few seconds, you should quickly press the E button on the keyboard, which will allow you to go to the configuration of kernel boot parameters: -
Scroll down to the line starting with the word
Linux
: -
Go to the end of this line (End key on the keyboard);
- Change the end of the line:
quiet
toinit=\bin\bash
and press the key combination Ctrl+X. This action will boot into bash; -
After loading bash, enter the command:
which will put the file system in write mode.
After entering the command, press Enter:
-
Enter the
passwd
command and press Enter; -
Enter a new password and press Enter:
-
Repeat entering the new password and press Enter;
- Enter the sync command and press Enter;
-
Go to the Power tab of the control panel and reboot the server –
Rebootbutton:
After rebooting the server, you can use the new password.
FreeBSD¶
After connecting KVM, you need to restart the server using the Ctrl+Alt+Del key combination. While the server is loading, the following window will be displayed:
You must select option numbered 4 – Boot FreeBSD in single user mode.
Next, the system will prompt you to specify shell
. It is possible to choose two options – press the Enter or type /bin/csh
:
If the server was restarted forcibly using the power button, then you should check the file system for errors:
Then you should remount the file system in write mode:
Next, you need to change the password (you must enter the new password twice):
At the end of the password change, you must restart the server:
Debian¶
After connecting KVM, you need to press the Esc key at the moment the inscription Press ESC to going to menu is displayed on the screen and go to the GRUB menu:
hen you should switch to edit mode – press the E key and select the kernel line starting with the word kernel
, and switch to edit mode again – E key.
At the end of the line, you need to add a parameter:
Then press the Enter and B keys. After completing the above steps, the system will be booted into single-user mode.
Further, you need to remount the root file system in write mode:
Next, you need to run passwd root
and enter the new password twice. Then you should restart the server:
Ubuntu¶
To reset the password, you need to restart the server – press the key combination Ctrl+Alt+Del.
After loading the BIOS menu, but before the OS starts, you need to stop the boot timer and go to the GRUB menu – press any key except Enter.
You need to boot the OS in single-user mode and edit the bootstrap line. The arrows on the keyboard are used to move between the lines. You should highlight the line Ubuntu and go into edit mode – press the E key:
You should find the line that starts with linux /boot
and replace the ro
parameter with rw
. You also need to add a new parameter init=/bin/bash
.
Next, press the key combination Ctrl+X or F10. This action will boot the OS in single-user mode.
You need to enter the command in the console:
And enter the new password twice:
Then you should save the changes:
And reboot the system: