0

context:

  • firstly, i got a new ubuntu 20.04 server with a password
  • I'm using OpenSSH client on Windows 10
  • I want to do passwordless login, then I
    • ssh to server using passwords,
    • manually create ~/.ssh /authorized_keys and open it in vim
    • copy&paste my public key content from my C:\users\me\.ssh\id_rsa.pub to ssh window.
    • exit that ssh session and try to passwordless login,
    • failed
  • (some more tries and many headbang) 🤕
  • I install Git Bash On Windows, then run ssh-copy-id and got another identical line in authorized_keys on the server
  • now I could successfully passwordless login to server

Why this happen? Does ssh-copy-id do more thing than just insert a line in (server) ~/.ssh/authorized_keys?

enter image description here

5
  • 1
    Please don't post screenshots of text. Copy the text here and use code formatting. Public keys don't need to be redacted. All that said, are the lines really identical? How did you paste it into Vim?
    – muru
    Commented Sep 13, 2023 at 4:13
  • The lines have different length, it should be easy to see they're not identical. Commented Sep 13, 2023 at 5:07
  • @muru I paste into vim using shift insert
    – Luke
    Commented Sep 14, 2023 at 2:36
  • @HolyBlackCat thanks, I will check it again
    – Luke
    Commented Sep 14, 2023 at 2:44
  • @HolyBlackCat thanks, it's all my bad.
    – Luke
    Commented Sep 14, 2023 at 2:45

1 Answer 1

1

Look at both entries in your .ssh/authorized_keys file. The first entry starts with sh-rsa, whereas your second starts with ssh-rsa. That’s most likely the problem. So when you copy/pasted your public key, you simply made a typo.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .