Table of Contents

Reset the Root Password in Oracle Linux

Ever need to reset the password for Root on an Oracle Linux box? You’ve come to the right place! Here’s how:

FYI, I did this tutorial in Oracle Enterprise Linux (OEL) 7, but this is a distro based on Red Hat Enterprise Linux (RHEL), so these instructions should more-or-less work on any similar distro to OEL/RHEL, give or take a few versions. Let’s get started:

Reboot Linux

Reboot Linux. When boot menu appears, press a key to stop it from booting any further. You should see something like this:

Press the “e” key and add line

Press the “e” key on the top line of the menu, and then on the next screen that appears, scroll down to the line that starts with “linux16” and change the end from “…quiet LANG…” to “…quiet rw init=/bin/bash LANG…” so it’ll look like this:

It’s fine if you don’t see the “LANG…” part after “…quiet” – just put the “rw init=/bin/bash” after “quiet” anyway.

Change password

At the prompt that appears, type “passwd” to change the root password:

SElinux and autolabel option

Now, depending on how your system is configured, you may also need to type “touch /.autorelabel” to have it perform a SELinux relabel of the disk to allow root login. Try it first without this, and if it doesn’t work, then try it with this (since it can take a while if you have a large disk).

Reboot

Type “/usr/sbin/reboot –f” to reboot.

Done

After waiting a few minutes for the reboot to finish, you should be able to log in as root with your new password!