I need to automate a script that logs into a server. I made an RSA key and upload it to the server's authorized_keys file:desktop$ ssh-keygen -f ~/.ssh/id_rsa_marge -P '' -t rsadesktop$ chmod 600 ~/.ssh/id_*desktop$ scp ~/.ssh/id_rsa_marge.pub me@2.4.6.8:~/password:desktop$ ssh me@2.4.6.8password:marge$ cat ~/id_rsa_marge.pub >> ~/.ssh/authorized_keysmarge$ whoamimemarge$ ls -la | grep sshdrw-------   2 me me     4096 May 29 16:02 .sshmarge$ ls -la .sshtotal 16drwx------  2 me me 4096 May 29 16:02 .drwx--x--x. 9 me me 4096 Aug 11 05:32 ..-rw-------  1 me me  398 Aug 11 04:14 authorized_keys-rw-r--r--  1 me me  414 May 29 16:02 known_hostsmarge$ cat .ssh/authorized_keys ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCzUvV0SMF+H7kwmEkJzXY1RqionS6DTtJiON3+9L6neKMaFb/FXc3UtK7oN/lsxNcHwv9s9GG4xp2UiUNk8NeT+/aFCjl7sMpDsW1+bn7sjhRFFw095qxvK52somSUKXlm9DP1pr0wj9r9Kxdph3HynxRsMkdPnWK2LVGhHzr3nh39mJ/3Fwaejl+sYnO8wgPfZbqZTA1xubhIQilv0XI8YAWUOM+Mn2QmyI12geTVKdD393wL0cDrkit/MXjMY6pimSFafrFJkaWV1BI4YOnkPRPo8oyoM4ywXhcCeb14JkOmKdSacUwSDsnCy/IDP51rcwItZrXxBiOHFZJW1Nlp dotancohen@desktopmarge$ exitdesktop$ cat .ssh/id_rsa_marge.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCzUvV0SMF+H7kwmEkJzXY1RqionS6DTtJiON3+9L6neKMaFb/FXc3UtK7oN/lsxNcHwv9s9GG4xp2UiUNk8NeT+/aFCjl7sMpDsW1+bn7sjhRFFw095qxvK52somSUKXlm9DP1pr0wj9r9Kxdph3HynxRsMkdPnWK2LVGhHzr3nh39mJ/3Fwaejl+sYnO8wgPfZbqZTA1xubhIQilv0XI8YAWUOM+Mn2QmyI12geTVKdD393wL0cDrkit/MXjMY6pimSFafrFJkaWV1BI4YOnkPRPo8oyoM4ywXhcCeb14JkOmKdSacUwSDsnCy/IDP51rcwItZrXxBiOHFZJW1Nlp dotancohen@desktopdesktop$ ls -la | grep .ssh-rw-------  1 dotancohen dotancohen     689 Aug 12 11:03 .lesshstdrwx------  3 dotancohen dotancohen    4096 Aug 12 11:05 .sshdesktop$ ls -la .ssh | grep canary-rw-------  1 dotancohen dotancohen  1675 Aug 11 12:13 id_rsa_marge-rw-------  1 dotancohen dotancohen   398 Aug 11 12:13 id_rsa_marge.pubdesktop$ grep -A 5 marge .ssh/configHost marge    User me    HostName 2.4.6.8    IdentityFile ~/.ssh/id_rsa_marge.pub    IdentitiesOnly yesHowever, when I try to log into the server it asks for a passphrase:desktop$ ssh -v margeOpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010debug1: Reading configuration data /home/desktop/.ssh/configdebug1: Applying options for margedebug1: Reading configuration data /etc/ssh/ssh_configdebug1: Applying options for *debug1: Connecting to 2.4.6.8 [2.4.6.8] port 22.debug1: Connection established.debug1: identity file /home/desktop/.ssh/id_rsa_marge.pub type 1debug1: identity file /home/desktop/.ssh/id_rsa_marge.pub-cert type -1debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.3debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.3 pat OpenSSH*debug1: Enabling compatibility mode for protocol 2.0debug1: Local version string SSH-2.0-OpenSSH_5.3debug1: SSH2_MSG_KEXINIT sentdebug1: SSH2_MSG_KEXINIT receiveddebug1: kex: server->client aes128-ctr hmac-md5 nonedebug1: kex: client->server aes128-ctr hmac-md5 nonedebug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sentdebug1: expecting SSH2_MSG_KEX_DH_GEX_GROUPdebug1: SSH2_MSG_KEX_DH_GEX_INIT sentdebug1: expecting SSH2_MSG_KEX_DH_GEX_REPLYdebug1: Host '2.4.6.8' is known and matches the RSA host key.debug1: Found key in /home/desktop/.ssh/known_hosts:2debug1: ssh_rsa_verify: signature correctdebug1: SSH2_MSG_NEWKEYS sentdebug1: expecting SSH2_MSG_NEWKEYSdebug1: SSH2_MSG_NEWKEYS receiveddebug1: SSH2_MSG_SERVICE_REQUEST sentdebug1: SSH2_MSG_SERVICE_ACCEPT receiveddebug1: Authentications that can continue: publickeydebug1: Next authentication method: publickeydebug1: Offering public key: /home/desktop/.ssh/id_rsa_marge.pubdebug1: Server accepts key: pkalg ssh-rsa blen 277debug1: PEM_read_PrivateKey faileddebug1: read PEM private key done: type <unknown>Enter passphrase for key '/home/desktop/.ssh/id_rsa_marge.pub': debug1: No more authentication methods to try.Permission denied (publickey).As can be seen, there is no passphrase for this key. Furthermore, from a different desktop I can use this key without entering a passphrase! Why does this one server demand that I enter a passphrase, when there is none?
RSA keys demanding nonexistant passphrase
linux;ssh
Enter passphrase for key '/home/desktop/.ssh/id_rsa_marge.pub': A passphrase for a public key file (.pub)?IdentityFile ~/.ssh/id_rsa_marge.pubThe identity file is a file on the client that lets you prove to the server that you're allowed to log in. That's a file containing a secret value. It's the private key file, not the public key file.Change this line toIdentityFile ~/.ssh/id_rsa_margeMake sure that what you've added to ~/.ssh/authorized_keys on the server (preferably by passing it to ssh-copy-id) is the public key file (.pub).