Before I get into this, I just wanted to say that I've read many posts about this problem and none of them were helpful. I tried changing the permissions and it didn't work.
Permission of ~/.ssh folder must be 700, ~/.ssh/id_rsa : 600, ~/.ssh/id_rsa.pub : 644
I've got two Ubuntu 20.04 machines, a desktop and a laptop. Using password based authentication, I was able to copy both public keys to the other computer using ssh-copy-id -i ~/.ssh/id_rsa.pub user@192.168.x.x. I then changed the following lines in /etc/ssh/sshd_config on both machines:
PubkeyAuthentication yes
PasswordAuthentication no
When I attempted to connect via ssh using public key from the desktop to the laptop, it worked fine. However, when I tried the opposite, laptop to desktop via public key, I got Permission denied (publickey). When I switch back from Public Key Authentication to Password authentication, it works. I wanted to post the ssh -vvv output but askubuntu marked it as spam.
Thank you.
ssh-copy-id
in the laptop pointing to the IP address of the desktop? Once you do that you should be able tossh
from the laptop to the desktop without entering the desktop's password. See this answer for a step-by-step how to setup the public key. Please edit your question and add all the new information. – user68186 Dec 09 '21 at 23:46ssh
, on the sending node, andsshd
, on the receiving node, exchange a list of authentication methods they offer/accept, and agree on a method they have in common. You can see the lists by adding the "-v
" option to yourssh
command, and can change the configuration. Seeman sshd_config
– waltinator Dec 10 '21 at 00:20sshd
daemons?sshd
only reads configuration when it starts up. – waltinator Dec 10 '21 at 01:47