Skip to content

Instantly share code, notes, and snippets.

@Nivratti
Created July 4, 2021 12:40
Show Gist options
  • Save Nivratti/5073b43ef6ee9af9709a7b66c122d36c to your computer and use it in GitHub Desktop.
Save Nivratti/5073b43ef6ee9af9709a7b66c122d36c to your computer and use it in GitHub Desktop.
force ssh client to use only password auth

For people receiving the Permission denied (publickey) error despite the other solutions here, the problem is likely that the server is set not to accept passwords. To change this, you need to get into the server (many services will allow you to access with a password via a virtual console on their management console) and:

  1. nano /etc/ssh/sshd_config

  2. Find PasswordAuthentication no and change it to yes, and uncomment it.

  3. Run sudo service sshd restart (or sudo systemctl restart sshd if using systemd services)

  4. Now try to log in, from a remote server, using one of the methods, such as ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no [email protected] or ssh user:@host_ip colon after username.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment