Ubuntu – SSH login using Ubuntu’s terminal – Permission denied (publickey)

puttyssh

I'm using ubuntu system to login to remote server using ssh. SSH is configured in my system and I can see my public ssh key but when I try something like ssh xx.xx.xx.xx it throws error Permission denied (publickey).

For the IP address which I'm trying to access, ssh username is ec5-user without any password.

Do I have to switch to that user in my ubuntu terminal before using ssh xx.xx.xx.xx ? Using putty, I'm able to login from windows system.

If I do ssh-keygen -lf ~/.ssh/id_rsa.pub, it gives soething like

2048 aa:b5:51:76:de:42:12:78:a1:ff:9e:74:d8:7d:59:24  amit@amit-Inspiron-N5010 (RSA)

Best Answer

Check .ssh folder permission (run ls -laR ~/.ssh):

.ssh folder should have 700, while private key 600 and the public one can have 644.

Moreover, you can have more information about the problem running ssh with full debug logs

ssh -vvv ...
Related Question