I have two keys in my .ssh
folder, one is an id_ed25519
key and the other an id_rsa
key. If I run :
ssh-add ir_ed25519
I get the Identity added ... message and all is fine. If, on the other hand I try ssh-add id_rsa
, it asks for a passphrase, I press enter since I have none (local project) and it returns me to the prompt. The server then rejects me with a (public key) error
.
EDIT:
user@machine:~/.ssh$ ls
authorized_keys config google_compute_engine google_compute_engine.pub google_compute_known_hosts id_ed25519 id_ed25519.pub id_rsa id_rsa.pub known_hosts
user@machine:~/.ssh$ ssh-add id_ed25519
Identity added: id_ed25519 (my_gitlab_key)
user@machine:~/.ssh$ ssh-add id_rsa
Enter passphrase for id_rsa:
user@machine:~/.ssh$
user@machine:~/.ssh$ ssh -p 27 user@server_URL.com
Enter passphrase for key '/home/user/.ssh/id_rsa':
user@server_URL.com: Permission denied (publickey).
The id_rsa
key belongs to the server.
EDIT 2 :
user@computer:~/.ssh$ ssh -p 27 user@server-URL.com -v
OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /home/user/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to server-URL.com [xxxxxxxxxx] port 27.
debug1: Connection established.
debug1: identity file /home/user/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_rsa-cert type -1
debug1: identity file /home/user/.ssh/id_ed25519 type 3
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ed25519-cert type -1
debug1: identity file /home/user/.ssh/google_compute_engine type 0
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/google_compute_engine-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4p1 Debian-10+deb9u6
debug1: match: OpenSSH_7.4p1 Debian-10+deb9u6 pat OpenSSH* compat 0x04000000
debug1: Authenticating to server-URL.com:27 as 'user'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:WCIqCPH...5A3dmWlf01g0m6k
debug1: Host '[server-URL.com]:27' is known and matches the ECDSA host key.
debug1: Found key in /home/user/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: ED25519 SHA256:HhRHqmr47/f0Lw+U3a+/a85ydnFvbns3KiQhKZbQC1Y /home/user/.ssh/id_ed25519
debug1: Authentications that can continue: publickey
debug1: Offering public key: RSA SHA256:D+NWN6yffzHS...s6JiUWVjEU /home/user/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
Enter passphrase for key '/home/user/.ssh/id_rsa':
debug1: Offering public key: RSA SHA256:iUFi29EEETE...Sv1Q6dhypY2o /home/user/.ssh/google_compute_engine
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
user@server-URL.com: Permission denied (publickey).