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:
-
nano /etc/ssh/sshd_config -
Find
PasswordAuthentication noand change it toyes, and uncomment it. -
Run
sudo service sshd restart(orsudo systemctl restart sshdif using systemd services) -
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]orssh user:@host_ipcolon after username.