Recovering SSH Access to an Oracle Linux 7 Instance
The default security configuration for the Oracle Linux 6.9 and 7.4 images released between December 18, 2017 and April 5, 2018 requires that credential rotation occur within 90 days. If you do not rotate credentials in the 90 day time frame, access to the instance will be denied. For more information, see Security Configurations Require Credential Rotation after 90 days.
If access to your Oracle Linux 7 instance is denied, and you are unable to log in, do not terminate the instance. You will need to perform the recovery steps below to regain access. If your instance is running Oracle Linux 6, see Recovering SSH Access to an Oracle Linux 6 Instance.
Confirm that the instance is running.
Reboot the instance from the Console. See Using the Console.
Once you see the following screen in your SSH client use the up arrow key to get to the top line:
The exact version number displayed for your instance may be different than the one shown in the image.
Scroll down to the last line, which starts with
Press the left arrow key to get to the end of the long, wrapped line that starts with
Press the space bar then add
init=/bin/bashto the end of the line. The entry should look similar to the following image:
If you make a mistake adding
init=/bin/bashto the line press the escape character to return to the menu and then start again from step 4.
Press Crtl-x to start the instance.
From the command prompt, run the following commands:
/bin/mount -o remount, rw /
chage --inactive=-1 --mindays=-1 --maxdays=-1 --warndays=-1 --expiredate=-1 --lastday=-1 opc
/sbin/useradd -D -f -1
/bin/sed -i.bkp 's/^PASS_MAX_DAYS 90$/PASS_MAX_DAYS 99999/g' /etc/login.defs
After completing these steps, the instance will reboot with SSH access restored.