Ssh key passphrase wrong but it’s right

sshssh-keys

I can't use my ssh id_rsa/id_rsa.pub keys because looks like ssh thinks that entered passphrase is wrong. But I'm sure that it's right.
Here is how it looks:

ssh myuser@myhost_ip -i ~/.ssh/id_rsa.pub 
The authenticity of host 'myhost_ip (myhost_ip)' can't be established.
RSA key fingerprint is SHA256: (some hash).
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'myhost_ip' (RSA) to the list of known hosts.
Enter passphrase for key '/Users/paul/.ssh/id_rsa.pub': 
Enter passphrase for key '/Users/paul/.ssh/id_rsa.pub': 
Enter passphrase for key '/Users/paul/.ssh/id_rsa.pub': 

So as far I understand it thinks that the passphrase is wrong.
Before this issue I've got another one (I'm not sure but maybe they are related?):

Permissions 0644 for '/Users/paul/.ssh/id_rsa.pub' are too open.

And I fixed it with chmod 400 ~/.ssh/id_rsa.pub. I'm not sure why this issue appeared and my guess it that these keys were generated on the Ubuntu and moved to MacOS.

So the question is: why ssh doesn't accept my passphrase and how to fix it?

Best Answer

Public keys don't get passphrases. Private keys do.

You are incorrectly trying to use your public key as your identity, which will never work. Use your private key.