Score:1

SSH - Permission denied (publickey)

cn flag

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 [email protected]. 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.

ar flag
Did you use the command `ssh-copy-id` in the laptop pointing to the IP address of the desktop? Once you do that you should be able to `ssh` from the laptop to the desktop without entering the desktop's password. See this [answer](https://askubuntu.com/questions/1107987/connect-two-computers-with-ssh-in-a-home-lan/1108044#1108044) for a step-by-step how to setup the public key. Please [edit your question](https://askubuntu.com/posts/1380171/edit) and add all the new information.
waltinator avatar
it flag
`ssh`, on the sending node, and `sshd`, 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 your `ssh` command, and can change the configuration. See `man sshd_config`
waltinator avatar
it flag
Did you restart the `sshd` daemons? `sshd` only reads configuration when it starts up.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.