When attempting to prevent automatic unlocking of local ESXi users by setting Security.AccountUnlockTime to 9999999, the lockout is unexpectedly released after 6 hours.
As a result, users are able to log in again despite the maximum unlock time constraint.
The following log is observed in syslog.log every 6 hours: USER root pid ###### cmd /bin/pam_tally2 --reset
syslog.log
| YYYY-MM-DDT06:00:00.864Z In(##) crond[######]: USER root pid ###### cmd /bin/pam_tally2 --reset YYYY-MM-DDT12:00:00.864Z In(##) crond[######]: USER root pid ###### cmd /bin/pam_tally2 --reset |
ESXi 8.0 U2 and later
This issue occurs because a cron job on ESXi regularly executes the /bin/pam_tally2 --reset command, which resets the failed authentication counter. When this command runs, the login attempt count is cleared, allowing users to log in before the configured lockout time expires.
This cron job was initially introduced in ESXi 8.0 U2 as a temporary workaround to prevent accidental user lockouts. If your security policy requires strict management of account lockout durations, disabling this cron job will not impact system operations.
To prevent unintended account unlocks, comment out the cron job that executes the reset command.
Additionally, since manual changes to the cron file do not survive an ESXi host reboot by default, you must also configure the script to persist across reboots.
Step 1: Comment out the cron job in the current environment
root privileges./bin/kill $(cat /var/run/crond.pid)
cp /var/spool/cron/crontabs/root /var/spool/cron/crontabs/root.old
chmod +w /var/spool/cron/crontabs/root
sed -i '\/bin\/pam_tally2 --reset/s/^/#/' /var/spool/cron/crontabs/root
chmod 1444 /var/spool/cron/crontabs/root
/usr/lib/vmware/busybox/bin/busybox crond
cat /var/spool/cron/crontabs/root | grep pam_tally2Step 2: Configure the changes to persist across ESXi host reboots
Open /etc/rc.local.d/local.sh
vi /etc/rc.local.d/local.sh
Append the following lines right before the exit 0 statement, then save and close the file.
sleep 30
chmod +w /var/spool/cron/crontabs/root
sed -i '\/bin\/pam_tally2 --reset/s/^/#/' /var/spool/cron/crontabs/root
chmod 1444 /var/spool/cron/crontabs/root
/bin/kill $(cat /var/run/crond.pid)
/usr/lib/vmware/busybox/bin/busybox crond
Run the backup script to save the changes made to local.sh to the system configuration.
auto-backup.sh
(Optional) Reboot the ESXi host and verify that the changes in /var/spool/cron/crontabs/root persist.