Root login failure after a corrupted authentication config

A production server stayed up, but root could not log in with the correct password. The cause was a corrupted /etc/login.defs. We restored it from the package through rescue mode, with no password resets.

29 September 2026  ·  3 min read

TRIGGER

Corrupted /etc/login.defs

PLATFORM

RHEL-family Linux, SELinux enforcing

ACCESS PATH

Rescue mode and chroot

ENGAGEMENT

Emergency access recovery

1

File replaced, nothing else touched

0

Passwords reset

10

Checks before return to normal

Environment

Linux authentication stack with one damaged layerSix layers take part in a root login: account configuration, password database, PAM, /etc/login.defs, SELinux and SSH or console. Every layer checked clean except /etc/login.defs, which package verification showed no longer matched the shadow-utils package.The password was right. One layer of the stack was not.✓Account configurationvalid, not locked or expired✓Password database/etc/passwd, /etc/shadow intact✓PAMrpm -V clean✕/etc/login.defsrpm -V: does not match shadow-utils✓SELinuxcontexts checked✓SSH / consolerpm -V cleanA failure in any one layer blocks the login, even with valid credentials.

Scroll the diagram sideways to see all of it →

Package verification found the one layer that had changed.

The problem

The server was up, but root could not get in. Root authentication suddenly stopped working on a production Linux server. The server and its services were still running, but administrators could no longer log in as root. The root password was correct and the account was valid, so the failure had to be in the authentication configuration, not the credentials.

Investigation

Verify the stack, not the password. We reviewed the authentication log (/var/log/secure), checked for lockouts with faillock, inspected ownership and SELinux contexts on the authentication files, and verified every package in the login path with rpm -V: shadow-utils, pam, util-linux and openssh-server. The account was not locked or expired. The finding came from package verification: rpm -V shadow-utils showed that /etc/login.defs no longer matched the installed package, and inspection confirmed the file was corrupted.

A correct root password does not guarantee that root authentication will succeed.

Root cause

A corrupted /etc/login.defs. /etc/login.defs is read by the Linux login and account-management stack. With the file damaged, root authentication could not complete, even though the account and password were correct.

At a glance

Challenge

Root login failed with a correct password while the server kept running.

Approach

Check every authentication layer and let package verification find the changed file.

Result

Root access restored by replacing one file: no password resets, no accounts lost, no application data affected.

The fix

Preserve, restore from the package, relabel. With root login unavailable, we booted into rescue mode, remounted the root filesystem read-write and entered the installed system with chroot. The damaged file was preserved first for later analysis. A clean /etc/login.defs was extracted from the matching shadow-utils package with rpm2cpio, compared with the damaged copy using diff, and put in place. restorecon then corrected its SELinux context, and the server was rebooted normally.

Outcome

Root access restored, nothing else changed. Root login worked again with the existing password. rpm -V shadow-utils came back clean, /etc/passwd and /etc/shadow were intact, pwck -r and grpck -r passed, password changes and test-user creation worked, SELinux contexts on the authentication files were correct, and no new authentication errors appeared in the logs. The damaged file was kept for root-cause analysis.

More case studies

InnoDB Crash Recovery

0 Data loss identified

Hidden DNS Dependency Outage

0 Rollbacks required

Hypervisor I/O Stalls

40 VMs returned to stable I/O

Locked out of a server that is still running?

We work through the authentication stack layer by layer, find what actually changed and restore only that, without resetting passwords or touching your data.