How To Reset CentOS 7 Root Password
Just like with other distributions, you can use the NoVNC console to reset CentOS 7 root password. By adding a simple line of code to the boot configuration you can update the password and get access back to your instance. To get started log in to your client account. Access the Discovery control panel for the instance you want to change the password on.
Access NoVNC Console
So, from the control panel click the NoVNC icon to bring up the console. Select the gear icon to the left and reboot the instance. When you see the list of Kernels, press the up arrow key to stop the NVMe VPS from automatic boot.
Next, select the kernel you usually use and press the “e” key.
Find the line starting linux16 and the section starting “ro”
So next, change “ro” to “rw” and add “init=/sysroot/bin/sh“. So the line looks like the below code. Once done press CNTRL + X to start the instance in single-user mode.
Reset CentOS 7 Password
In single-user mode enter the below commands to update the root password. On reboot, the instance password will be updated.
chroot /sysroot passwd root touch /.autorelabel exit reboot
Instead of using passwords why not use an SSH key? By using an SSH key you can log in to your instances without having to type a password and, adding an SSH key is easy. Go passwordless. Learn how to Create SSH Keys and install them in the Discovery control panel.
How was this article?
You might also like
More from Instance Management
If you have installed your Discovery instance using a distribution ISO. Then it's likely your drive will be using a …
How To Configure An Internal MySQL Database Server High-value assets like database servers are always a target for hackers. Typically, these …