2

been a looong time lurker of stackoverflow, but for the first time today the answers I found in many other threads did not work.

Am trying to setup an ssh connection so that it doesn't ask for password: note that I already did this, for the same server, ~1 year ago, with no issues. I was however 'kicked out' by mistake and so now I have to set it up again. However, after doing what (I think) are the proper steps, it still asks me for the password.

I created my ssh key pair, copied it with ssh-copy-id. Double checking, the authorized_keys on the server have indeed listed the same public key that I have in ~/.ssh/id_rsa.pub. I checked also the permissions of my ssh files, which are the following:

-rw-r--r-- 1 riccardobarbieri riccardobarbieri 1332 Jun 27 11:00 known_hosts
-rw-rw-r-- 1 riccardobarbieri riccardobarbieri  101 Okt 19 14:04 config
-rw-r--r-- 1 riccardobarbieri riccardobarbieri  584 Dez  5 16:21 id_rsa.pub
-rw------- 1 riccardobarbieri riccardobarbieri 2675 Dez  5 16:21 id_rsa

And the permissions of the .ssh folder

drwx------  2 riccardobarbieri riccardobarbieri     4096 Dez  5 16:40 .ssh

When connecting via ssh-vv, this is the message I get (not all of it, just the relevant bit)

OpenSSH_8.2p1 Ubuntu-4ubuntu0.3, OpenSSL 1.1.1f  31 Mar 2020
debug1: Reading configuration data /home/riccardobarbieri/.ssh/config
debug1: /home/riccardobarbieri/.ssh/config line 1: Applying options for ldas-grid.ligo-wa.caltech.edu
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolving "ldas-grid.ligo-wa.caltech.edu" port 22
debug2: ssh_connect_direct
debug1: Connecting to ldas-grid.ligo-wa.caltech.edu [198.129.208.250] port 22.
debug1: Connection established.
debug1: identity file /home/riccardobarbieri/.ssh/id_rsa type 0
debug1: identity file /home/riccardobarbieri/.ssh/id_rsa-cert type -1
debug1: identity file /home/riccardobarbieri/.ssh/id_dsa type -1
debug1: identity file /home/riccardobarbieri/.ssh/id_dsa-cert type -1
debug1: identity file /home/riccardobarbieri/.ssh/id_ecdsa type -1
debug1: identity file /home/riccardobarbieri/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/riccardobarbieri/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/riccardobarbieri/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/riccardobarbieri/.ssh/id_ed25519 type -1
debug1: identity file /home/riccardobarbieri/.ssh/id_ed25519-cert type -1
debug1: identity file /home/riccardobarbieri/.ssh/id_ed25519_sk type -1
debug1: identity file /home/riccardobarbieri/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/riccardobarbieri/.ssh/id_xmss type -1
debug1: identity file /home/riccardobarbieri/.ssh/id_xmss-cert type -1
[...]
debug1: Next authentication method: publickey
debug1: Offering public key: riccardobarbieri@laptop-404148 RSA SHA256:QfrRbeBmZNHQ+uO4Tcrl2MBNMMEka2hzf/I0VUyQe7I agent
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Offering public key: /home/riccardobarbieri/.ssh/id_rsa RSA SHA256:pySUy0pjP+sUpm/ieNJgjmTLkYOD6NSmPWPLGVliAZA
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /home/riccardobarbieri/.ssh/id_dsa
debug1: Trying private key: /home/riccardobarbieri/.ssh/id_ecdsa
debug1: Trying private key: /home/riccardobarbieri/.ssh/id_ecdsa_sk
debug1: Trying private key: /home/riccardobarbieri/.ssh/id_ed25519
debug1: Trying private key: /home/riccardobarbieri/.ssh/id_ed25519_sk
debug1: Trying private key: /home/riccardobarbieri/.ssh/id_xmss
debug2: we did not send a packet, disable method
debug1: Next authentication method: password

Any help will be really appreciated, as I wasted basically all of today on this :D

P.S. I do not have root rights for the remote server.

chepner
  • 497,756
  • 71
  • 530
  • 681
  • One thing that's odd is that it looks like you are sending two different public keys, the first from an SSH agent, the second from `~/.ssh/id_rsa.pub`. How are you confirming that either appears in the remote host's authorized_keys file? – chepner Dec 05 '22 at 16:06
  • I checked the content of id_rsa.pub, and it matches with one of the authorized keys in the remote server. Should I "delete" the ssh-agent key maybe? If yes, how do I do so? – Riccardo Barbieri Dec 06 '22 at 08:41
  • @RiccardoBarbieri I'm facing the same problem now, have you managed to fix it in the meanwhile? – Ljubisa Livac Mar 05 '23 at 18:19

1 Answers1

0

Try adding more verbosity to the debugging (the ssh option is -vvv) so that debug3 messages appear. This way you will see the type of packets that are being sent and received. Then you can continue reading here.

For instance, if you receive a packet type 51 it is possible that authentication using publickey is simply disabled in /etc/sshd_config. Would be a good reason why you got kicked out in the first place. If that's the case, only the admin can (should) change that configuration.