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 invim
- 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 inauthorized_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
?
Look at both entries in your
.ssh/authorized_keys
file. The first entry starts withsh-rsa
, whereas your second starts withssh-rsa
. That’s most likely the problem. So when you copy/pasted your public key, you simply made a typo.