I have a key
~/.ssh/id_rsa
and I added the pub key to my authorized keys:cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
I also changed my permissions to 600:
sudo chmod 600 ~/.ssh/authorized_keys
I checked and
/etc/ssh/sshd_config
is set for public key auth and has password auth as no.PubkeyAuthentication yes PasswordAuthentication no
I tried adding:
ssh-keyscan -t rsa localhost > /etc/ssh/ssh_known_hosts
I copied my id:
ssh-copy-id myusername@127.0.0.1
I restarted the service:
sudo service sshd restart
But despite all that, it still asks for a password! How can i make it not ask for one?
More Info:
When I do
ssh localhost
it asks for a password, but when I domyusername@localhost
it works! Why is this?
Answer
It was using a different user from ~/.ssh/config
than the one I was logged in as.
Attribution
Source : Link , Question Author : Don Rhummy , Answer Author : Don Rhummy