2

After Running ssh-keygen in git bash when I am executing

$ scp id_rsa.pub [email protected]:.ssh/authorized_keys

I am getting

The authenticity of host '192.168.12.232 (192.168.12.232)' can't be established.

ECDSA key fingerprint is SHA256:v9aX9gU44tKMXefUA1V2bgPVzP1PoICupP+cpU3sNB4.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added '192.168.12.232' (ECDSA) to the list of known hosts.

[email protected]'s password:

id_rsa.pub                                                  100%  403     3.2KB/s   00:00

After this when I an trying to verify weather passwordless authentication is successful or not using

$ ssh [email protected] ls

I am getting this

[email protected]'s password:

It should not ask for password I guess in this step.

What am I doing wrong can anyone help?

2
  • Run ssh command with -vvv to check debug output. Commented May 10, 2021 at 10:46
  • Hint: next time use ssh-copy-id instead of scp. Commented May 10, 2021 at 13:45

2 Answers 2

1

Use this command after executing $ scp id_rsa.pub [email protected]:.ssh/authorized_keys

“ ssh {username}@{host:port} “chmod 700 .ssh ; chmod 640 .ssh/authorized_keys” ”

and after successful execution run you command which is asking for password.

Sign up to request clarification or add additional context in comments.

Comments

1

You need to check the rights associated to the created ~/.ssh/authorized_keys file.
As seen here or here, it should be 600 (rw-------), and an scp might create the file with rights too open for SSH daemon to operate on.

That is why, as commented, an ssh-copy-id is preferable.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.