When I first discovered the magic of passwordless SSH login using ssh keys, I was thrilled with the convenience of logging in directly. But sometimes we do not want to use ssh keypairs to log in. Perhaps there are different sets of hosts using different keys - in this case, setting up ~/.ssh/config with matching key/host is the way to go. Or perhaps you want to troubleshooting password authentication issue.
Password Authentication
Using the PreferredAuthentication option should work
ssh -o PreferredAuthentications=password hostname
Unfortunately it sometimes does not work. The remote host may have preferred SSH keys when available. Or the remote hosts' SSH client configuration prefers SSH key.
The following options should ensure that only Password authentication is used
ssh -o PasswordAuthentication=yes -o PreferredAuthentications=keyboard-interactive,password -o PubkeyAuthentication=no hostname
No comments:
Post a Comment