If I use pubkey auth from e.g.: an Ubuntu 11.04 how can I set the ssh client to use only password auth to a server? (just needed because of testing passwords on a server, where I default log in with key)
I found a way:
mv ~/.ssh/id_rsa ~/.ssh/id_rsa.backup
mv ~/.ssh/id_rsa.pub ~/.ssh/id_rsa.pub.backup
and now I get prompted for password, but are there any offical ways?
-o PubkeyAuthentication=no
was sufficient in my case. – mivk Sep 04 '16 at 10:04-o PreferredAuthentications=keyboard-interactive -o PubkeyAuthentication=no
instead – guido Sep 17 '16 at 15:23PasswordAuthentication
. In fact, I'm here because I wanted to test that disabling password auth worked correctly on my host. – RubberDuck Sep 08 '18 at 14:39password
withkeyboard-interactive
make it work, as spotted by guido :ssh -o PreferredAuthentications=keyboard-interactive -o PubkeyAuthentication=no me@example.com
– tobiasBora Sep 15 '18 at 17:19Permission denied (publickey,password)
which seemed to suggest that a password should be accepted, but none of the options above would actually cause ssh to prompt me for the password. Turns out it was a configuration error in~/.ssh/config
that was setup to use key authentication. Who knew this prevents all command line options from taking effect! – Jonathan Cross Mar 31 '20 at 10:44sshd_config
. – reinierpost Sep 28 '20 at 13:49-o UserKnownHostsFile=/dev/null
. Otherwise it may bail out with an errorWARNING: REMOTE HOST IDENTIFICATION HAS CHANGED
. This may happen for example if remote host has a system booted different to the one you had originally key generated for. – Hi-Angel May 27 '21 at 09:51ssh -o "PasswordAuthentication yes" user@host
– Summer-Sky Feb 11 '23 at 21:57