Root Login Permission Denied on CentOS7

A system that was a fresh installation of CentOS 7 Linux was just completed. After all the updates, the user began to install an application. After some time, the user logged out of the system and could not log back into it. As a root user, the administrator was unable to access the virtual machine even via console. This eliminated ssh and led to something bigger.

The issue was simple. The user added a couple of custom limits to the ulimits. Well, no limit at all, unlimited. These limits prevented even root logon.

Two part resolution. – After logging in via single user mode.

  • Commented out the offending lines so that the end user will start with more restrictive constraints.
  • Added the following line to the end of /etc/pam.d/login
session required pam_limits.so

Restarted the server, and was able to logon.

Source(s)

  • https://www.linuxsecrets.com/discussions/8832-root-login-permission-denied
  • https://serverfault.com/questions/235356/open-file-descriptor-limits-conf-setting-isnt-read-by-ulimit-even-when-pam-limi