Question

Cannot login to droplet with ssh after rebuild

Posted November 25, 2021 92 views
NetworkingDigitalOcean Droplets

i did rebuild my droplet a few days ago. since then i couldn’t connect my droplet using shh again.
i have created new ssh hey using
ssh-keygen -t rsa
and defined it to SSH keys under the security settings.
and still cannot login to my droplet.
i’ve even used ssh <username>@<ipaddress> -i and set my shh file but. it did not work me too.
Created ticket for getting help with this issue. But it didn’t even work.
Does anyone else got this problem

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hello, @orkunkahraman

Could you please share the output of the ssh command so we can check it? Also, you can add the -vvv argument to get more verbose output.

ssh -vvv <username>@<ipaddress>

If you’ve created new keys you can check our tutorial on How to Upload an SSH Public Key to an Existing Droplet

https://docs.digitalocean.com/products/droplets/how-to/add-ssh-keys/to-existing-droplet/

Hope that this helps!
Regards,
Alex

  • this is the output of -vvv argument. and checked the link and it doesn’t work neither. And replaced the folder of ssh (<my_ssh_folder>) and ip adress (<ip_adress>) in output btw.
    OpenSSH8.5p1, OpenSSL 1.1.1k 25 Mar 2021
    debug1: Reading configuration data /etc/ssh/ssh
    config
    debug2: resolvecanonicalize: hostname <ipadress> is address
    debug3: expanded UserKnownHostsFile ’~/.ssh/knownhosts’ -> ’<mysshfolder>/knownhosts’
    debug3: expanded UserKnownHostsFile ’~/.ssh/knownhosts2’ -> ’<mysshfolder>/knownhosts2’
    debug3: sshconnectdirect: entering
    debug1: Connecting to <ip_adress> [<ip_adress>] port 22.
    debug3: setsocktos: set socket 3 IPTOS 0x48
    debug1: Connection established.
    debug1: identity file <my
    sshfolder>/idrsa type 0
    debug1: identity file <my_ssh_folder>/idrsa-cert type -1
    debug1: identity file <my
    sshfolder>/iddsa type 0
    debug1: identity file <my_ssh_folder>/iddsa-cert type -1
    debug1: identity file <my
    sshfolder>/idecdsa type -1
    debug1: identity file <my_ssh_folder>/idecdsa-cert type -1
    debug1: identity file <my
    sshfolder>/idecdsask type -1
    debug1: identity file <my
    sshfolder>/idecdsask-cert type -1
    debug1: identity file <my
    sshfolder>/ided25519 type -1
    debug1: identity file <my_ssh_folder>/ided25519-cert type -1
    debug1: identity file <my
    sshfolder>/ided25519sk type -1
    debug1: identity file <my
    sshfolder>/ided25519sk-cert type -1
    debug1: identity file <my
    sshfolder>/idxmss type -1
    debug1: identity file <my_ssh_folder>/idxmss-cert type -1
    debug1: Local version string SSH-2.0-OpenSSH
    8.5
    debug1: Remote protocol version 2.0, remote software version OpenSSH7.6p1 Ubuntu-4ubuntu0.5
    debug1: compat
    banner: match: OpenSSH7.6p1 Ubuntu-4ubuntu0.5 pat OpenSSH7.0,OpenSSH_7.1,OpenSSH7.2*,OpenSSH7.3,OpenSSH_7.4,OpenSSH7.5*,OpenSSH7.6,OpenSSH_7.7 compat 0x04000002
    debug2: fd 3 setting ONONBLOCK
    debug1: Authenticating to <ip
    adress>:22 as ‘root’
    debug3: recordhostkey: found key type ECDSA in file <mysshfolder>/knownhosts:1
    debug3: loadhostkeysfile: loaded 1 keys from <ip_adress>
    debug1: loadhostkeys: fopen <mysshfolder>/knownhosts2: No such file or directory
    debug1: loadhostkeys: fopen /etc/ssh/sshknownhosts: No such file or directory
    debug1: load
    hostkeys: fopen /etc/ssh/sshknownhosts2: No such file or directory
    debug3: orderhostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp256
    debug3: send packet: type 20
    debug1: SSH2
    MSGKEXINIT sent
    debug3: receive packet: type 20
    debug1: SSH2
    MSGKEXINIT received
    debug2: local client KEXINIT proposal
    debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c
    debug2: host key algorithms: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp256,ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256,ssh-rsa
    debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,3des-cbc,aes256-cbc,aes192-cbc
    debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,3des-cbc,aes256-cbc,aes192-cbc
    debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
    debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
    debug2: compression ctos: none,zlib@openssh.com,zlib
    debug2: compression stoc: none,zlib@openssh.com,zlib
    debug2: languages ctos:
    debug2: languages stoc:
    debug2: first
    kexfollows 0
    debug2: reserved 0
    debug2: peer server KEXINIT proposal
    debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1
    debug2: host key algorithms: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
    debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
    debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
    debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
    debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
    debug2: compression ctos: none,zlib@openssh.com
    debug2: compression stoc: none,zlib@openssh.com
    debug2: languages ctos:
    debug2: languages stoc:
    debug2: first
    kexfollows 0
    debug2: reserved 0
    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
    debug3: send packet: type 30
    debug1: expecting SSH2
    MSGKEXECDHREPLY
    debug3: receive packet: type 31
    debug1: SSH2
    MSGKEXECDHREPLY received
    debug1: Server host key: ecdsa-sha2-nistp256 SHA256:a2b1nqba8mkB84xnP9003k4Zu7KzRWz3jxv+IWxqeYw
    debug3: record
    hostkey: found key type ECDSA in file <my_ssh_folder>/knownhosts:1
    debug3: load
    hostkeysfile: loaded 1 keys from <ipadress>
    debug1: loadhostkeys: fopen <mysshfolder>/knownhosts2: No such file or directory
    debug1: loadhostkeys: fopen /etc/ssh/sshknownhosts: No such file or directory
    debug1: load
    hostkeys: fopen /etc/ssh/sshknownhosts2: No such file or directory
    debug1: Host ’<ip_adress>’ is known and matches the ECDSA host key.
    debug1: Found key in <my_ssh_folder>/knownhosts:1
    debug3: send packet: type 21
    debug2: set
    newkeys: mode 1
    debug1: rekey out after 134217728 blocks
    debug1: SSH2MSGNEWKEYS sent
    debug1: expecting SSH2MSGNEWKEYS
    debug3: receive packet: type 21
    debug1: SSH2MSGNEWKEYS received
    debug2: setnewkeys: mode 0
    debug1: rekey in after 134217728 blocks
    debug1: Will attempt key: <my
    sshfolder>/idrsa RSA SHA256:0AqHa9f/qoT+OXMinbx5zQ/kHRmtcmApZArv5mcAOHU
    debug1: Will attempt key: <my_ssh_folder>/iddsa RSA SHA256:tmOeVfEp3GC+M+t1g8o6r8p42gHsU5C74csrv2Wgu+c
    debug1: Will attempt key: <my
    sshfolder>/idecdsa
    debug1: Will attempt key: <my_ssh_folder>/idecdsask
    debug1: Will attempt key: <my_ssh_folder>/ided25519
    debug1: Will attempt key: <my
    sshfolder>/ided25519sk
    debug1: Will attempt key: <my
    sshfolder>/idxmss
    debug2: pubkeyprepare: done
    debug3: send packet: type 5
    debug3: receive packet: type 7
    debug1: SSH2
    MSGEXTINFO received
    debug1: kexinputextinfo: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
    debug3: receive packet: type 6
    debug2: service
    accept: ssh-userauth
    debug1: SSH2MSGSERVICEACCEPT received
    debug3: send packet: type 50
    debug3: receive packet: type 51
    debug1: Authentications that can continue: publickey
    debug3: start over, passed a different list publickey
    debug3: preferred publickey,keyboard-interactive,password
    debug3: authmethod
    lookup publickey
    debug3: remaining preferred: keyboard-interactive,password
    debug3: authmethodisenabled publickey
    debug1: Next authentication method: publickey
    debug1: Offering public key: <my_ssh_folder>/idrsa RSA SHA256:0AqHa9f/qoT+OXMinbx5zQ/kHRmtcmApZArv5mcAOHU
    debug3: send packet: type 50
    debug2: we sent a publickey packet, wait for reply
    debug3: receive packet: type 51
    debug1: Authentications that can continue: publickey
    debug1: Offering public key: <my
    sshfolder>/iddsa RSA SHA256:tmOeVfEp3GC+M+t1g8o6r8p42gHsU5C74csrv2Wgu+c
    debug3: send packet: type 50
    debug2: we sent a publickey packet, wait for reply
    debug3: receive packet: type 51
    debug1: Authentications that can continue: publickey
    debug1: Trying private key: <my_ssh_folder>/idecdsa
    debug3: no such identity: <my
    sshfolder>/idecdsa: No such file or directory
    debug1: Trying private key: <my_ssh_folder>/idecdsask
    debug3: no such identity: <my_ssh_folder>/idecdsask: No such file or directory
    debug1: Trying private key: <my_ssh_folder>/ided25519
    debug3: no such identity: <my
    sshfolder>/ided25519: No such file or directory
    debug1: Trying private key: <my_ssh_folder>/ided25519sk
    debug3: no such identity: <my_ssh_folder>/ided25519sk: No such file or directory
    debug1: Trying private key: <my_ssh_folder>/idxmss
    debug3: no such identity: <my
    sshfolder>/idxmss: No such file or directory
    debug2: we did not send a packet, disable method
    debug1: No more authentication methods to try.
    root@<ip_adress>: Permission denied (publickey).