User Tools

Site Tools


how-to:force_ssh_to_prompt_for_password

Force SSH to Prompt for Password

If you use key-based authentication instead of passwords for your SSH hosts, good for you. While key-based authentication makes life easy, occasionally the need arises for that host to prompt you for a password. Recently I drew the password rotation straw at work for our SOX systems and needed to rotate the password on a host which my system signature is stored in the authorized_keys file. Getting to the host was not an issue; however, once I changed the password I needed a prompt to enter it to verify the rotation was successful. With my key being stored, there was no prompt even when changing from my ID to root@host.example.com. A quick Google search lead me to the following solution:

ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no root@host.example.com

Including the two -o options prompted me for the password as expected.

how-to/force_ssh_to_prompt_for_password.txt · Last modified: 2020/11/02 09:09 by curry_searle