So I need to log in to a machine using a password instead of a key, which I practically never do. Seems it should be easy but nope, ssh refuses to use anything but a key.
ssh -o PreferredAuthentications=keyboard-interactive -o PubkeyAuthentication=no root@ip-address
root@ip-address: Permission denied (publickey). 1 5 Answers
You try using correct parameters for disabling authentication over keys. Maybe server reject password authentication? Check server ssh configuration.
2Permission denied (publickey)The "(publickey)" string in that error message is the list of authentication methods accepted by the remote server. In this case the remote server only accepts public key authentication. You can change your client parameters all you like, but it won't alter the fact that the server will only accept public key authentication.
To log in with a password, you'd have to start by reconfiguring the remote server to accept password authentication.
Turns out the solution was to set PasswordAuthentication yes in /etc/ssh/sshd_config.
Thanks to the several people who pointed me in the right direction.
root@ip-address: Permission denied (publickey)This message means your server only allow publickey, thus please enable password auth in /etc/sshd_config with:
Password Authentication yesIt is possible your system allow password but not keyboard-interaction, like
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)In this case, you need to use following instead:
ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no To use password authentication instead of a key, SSH must allow passwords. Inside of /etc/ssh/sshd_config Change the PasswordAuthentication option from no to yes (Note this is bad practice):
PasswordAuthentication yesBecause your example shows the user as root, you must also allow root to login via a password. (Note this is bad practice)
PermitRootLogin yesRestart ssh for the setting to take effect:
systemctl restart sshdNow, you can specify you desire ssh when connecting via CLI rather than permanently with config files:
ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no -o PasswordAuthentication=yes root@ip-address