Fix Keyboard Interactive Prompts Access Denied
In this article
Yes, you can resolve end-of-keyboard-interactive access denied errors by verifying SSH credentials, checking server configuration, and ensuring proper authentication methods are enabled. This error typically occurs during SSH login when the server rejects the provided credentials or authentication sequence, often due to misconfigured PAM modules, expired passwords, or disabled keyboard-interactive authentication.
What You'll Need
- Access to the server via console or another admin method (such as out-of-band management or cloud provider dashboard)
- Valid SSH client (OpenSSH, PuTTY, or equivalent)
- Administrative credentials (root or sudo access) for the target server
- Network connectivity to the server on port 22 (or custom SSH port)
- Knowledge of the user account and expected authentication method (password, 2FA, etc.)
Step-by-Step
- Confirm network connectivity to the SSH server using
pingandtelnetornc -zvto verify port 22 is reachable. If unreachable, resolve firewall or routing issues first. - Attempt SSH login with verbose output enabled: run
ssh -vvv username@server_ip. This reveals where in the authentication process the failure occurs—look for lines indicating "keyboard-interactive" prompts ending in "Access denied". - Check if the user account is locked, expired, or disabled on the server. Use direct console access or another admin session to run
passwd -S username(Linux) to verify account status. - Inspect the SSH server configuration file
/etc/ssh/sshd_config. Confirm thatAuthenticationMethods(if set) includeskeyboard-interactiveorkeyboard-interactive:info. If not, add it or comment out restrictive lines. - Ensure
ChallengeResponseAuthenticationis set toyesinsshd_config. This setting enables keyboard-interactive prompts. After editing, restart the SSH service withsudo systemctl restart sshdor equivalent. - Verify that PAM (Pluggable Authentication Modules) is correctly configured. Check
/etc/pam.d/sshdfor anyauth requiredlines that might reject access—such as expired passwords or failed 2FA modules. Temporarily comment out non-essential lines to test. - If using two-factor authentication (like Google Authenticator), ensure the time on the server is synchronized using
timedatectl statusandsudo ntpdate -s time.nist.govor similar. Time drift can cause 2FA tokens to be rejected. - Test with a different user account known to work. If that succeeds, the issue is isolated to the original user’s configuration, home directory permissions, or PAM settings.
- Check the user’s home directory and
~/.sshfolder permissions. The home directory should be755or700,.sshshould be700, andauthorized_keysshould be600. Fix withchmodandchownas needed. - Review system logs using
sudo journalctl -u sshortail /var/log/auth.logto identify specific rejection reasons—such as "PAM account expired", "maximum authentication attempts exceeded", or "keyboard-interactive failed".
Common Mistakes
- Assuming the SSH config change takes effect without restarting the
sshdservice—always restart after editingsshd_config. - Overlooking PAM configuration as the root cause—even if SSH settings are correct, PAM can silently reject authentication.
- Editing
sshd_configremotely without a backup session, risking lockout. Always test changes from a console or secondary connection. - Setting overly permissive file permissions on
.sshdirectories, which SSH may reject for security reasons. - Forgetting that some cloud servers disable password authentication by default—verify
PasswordAuthentication yesif using passwords.
Tips
- Always use
ssh -vvvto get detailed debug output—it shows exactly which authentication methods are offered and rejected. - Use a local user account with console access for troubleshooting—avoid relying solely on remote SSH.
- Keep a backup admin user with password login enabled, even if others use SSH keys, for recovery access.
- Regularly audit
sshd_configand PAM settings after system updates—some updates reset defaults. - If using 2FA, ensure users know to enter both password and token in sequence when prompted.
Troubleshooting
If access is still denied after following the steps:
- Temporarily enable
PermitRootLogin yes(then set back toprohibit-passwordornoafter fixing) to test if root login works—this isolates user-specific issues. - Comment out all
authlines in/etc/pam.d/sshdexceptpam_permit.soto bypass PAM rejections—only for testing, never in production. - Check if the user’s shell is valid and listed in
/etc/shells. A missing or invalid shell prevents login even with correct credentials. - Look for account expiration with
chage -l username. IfAccount expiresshows a past date, extend it withsudo chage -E -1 username. - If the server is in a cloud environment, use the provider’s serial console (e.g., Google Cloud Console, AWS EC2 Serial Console) to access the system without SSH.
- After changes, always test from a new SSH session—do not rely on existing connections.
Frequently Asked Questions
What causes keyboard-interactive access denied errors?
These errors occur when the server’s SSH or PAM configuration rejects the authentication sequence, often due to expired passwords, incorrect PAM settings, or disabled keyboard-interactive authentication.
Does SSH key authentication bypass this error?
Yes, if configured, SSH key authentication operates outside keyboard-interactive and may succeed even when password/2FA methods fail.
Can I fix this without console access?
Not safely. If SSH is rejecting all login attempts, you need out-of-band access (like a cloud console) to inspect and correct server settings.
Why does my password work on console but not via SSH?
The SSH daemon may enforce additional PAM rules or authentication methods (like 2FA) not used at the console, causing divergence in access behavior.
Is keyboard-interactive the same as password authentication?
No. Keyboard-interactive is a flexible method that can prompt for multiple inputs (password, token, etc.), while password authentication is a specific single-password method.
How do I disable 2FA if it’s causing the error?
Comment out or remove the 2FA module line (e.g., auth required pam_google_authenticator.so) in /etc/pam.d/sshd, then restart SSH.