Question

Unable to connect with SSH or SFTP (new user)

I just obtained a new ‘django’ droplet and am able to connect to it with the console interface in the web browser. I believe I created a private/public key pair and saved it correctly. However, I am unable to connect to the droplet from my Windows machine with any of the following programs: putty, ssh, sftp, fileZilla even though I believe I am following the instructions.

First of all, there is a discrepancy in the instructions from DigitalOcean because the console login message-of-the-day says to use a password (printed explicitly in the console window) and username ‘django’, but the on-line docs say to use a public/private key and username ‘root’. But I can’t seem to get any combination of password/public-private key/username ‘root’/username ‘django’ to work in any of putty, ssh, sftp or fileZilla.

Here is the log file from logging in with putty using ‘root’ as the user-name and specifying SSH > Auth > Private Key file for authentication:

=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2022.07.06 13:30:17 =~=~=~=~=~=~=~=~=~=~=~=
login as: root
Server refused our key



Here is the output from -vvv from attempting to connect with ssh:

c:\Users\vavasis\OneDrive - University of Waterloo\Personal\XXX>ssh django@137.184.6.182 -vvv -i ../key3_ssh
OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug3: Failed to open file:C:/Users/vavasis/.ssh/config error:2
debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2
debug2: resolve_canonicalize: hostname 137.184.6.182 is address
debug2: ssh_connect_direct
debug1: Connecting to 137.184.6.182 [137.184.6.182] port 22.
debug1: Connection established.
debug3: Failed to open file:c:/Users/vavasis/OneDrive - University of Waterloo/Personal/XXX/key3_ssh.pub error:2
debug1: identity file ../key3_ssh type -1
debug3: Failed to open file:c:/Users/vavasis/OneDrive - University of Waterloo/Personal/XXX/key3_ssh-cert error:2
debug3: Failed to open file:c:/Users/vavasis/OneDrive - University of Waterloo/Personal/XXX/key3_ssh-cert.pub error:2
debug1: identity file ../key3_ssh-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2p1 Ubuntu-4ubuntu0.4
debug1: match: OpenSSH_8.2p1 Ubuntu-4ubuntu0.4 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to 137.184.6.182:22 as 'django'
debug3: hostkeys_foreach: reading file "C:\\Users\\vavasis/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file C:\\Users\\vavasis/.ssh/known_hosts:2
debug3: load_hostkeys: loaded 1 keys from 137.184.6.182
debug3: Failed to open file:C:/Users/vavasis/.ssh/known_hosts2 error:2
debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts error:2
debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts2 error:2
debug3: order_hostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT 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,diffie-hellman-group14-sha1,ext-info-c
debug2: host key algorithms: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519-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,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
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,zlib
debug2: compression stoc: none,zlib@openssh.com,zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 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
debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ssh-rsa,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_kex_follows 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_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:Zm1Z0pFxaRfudg0FJIza+S85jCrUP6IJRincoe41sqw
debug3: hostkeys_foreach: reading file "C:\\Users\\vavasis/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file C:\\Users\\vavasis/.ssh/known_hosts:2
debug3: load_hostkeys: loaded 1 keys from 137.184.6.182
debug3: Failed to open file:C:/Users/vavasis/.ssh/known_hosts2 error:2
debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts error:2
debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts2 error:2
debug1: Host '137.184.6.182' is known and matches the ECDSA host key.
debug1: Found key in C:\\Users\\vavasis/.ssh/known_hosts:2
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug3: unable to connect to pipe \\\\.\\pipe\\openssh-ssh-agent, error: 2
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: Will attempt key: ../key3_ssh  explicit
debug2: pubkey_prepare: done
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT 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: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: ../key3_ssh
debug3: failed to open file:c:/dev/tty error:3
debug1: read_passphrase: can't open /dev/tty: No such file or directory
Enter passphrase for key '../key3_ssh':
debug3: sign_and_send_pubkey: RSA SHA256:SuoIf3dIQUhcsAbhL9U+nIFdI5B+UoNl9X3JvE0Fy4E
debug3: sign_and_send_pubkey: signing using rsa-sha2-512
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
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
django@137.184.6.182: Permission denied (publickey).

c:\Users\vavasis\OneDrive - University of Waterloo\Personal\XXX>

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @stephenvavasis,

It seems when you are trying to connect, the program you are using can’t find your SSH key and thus it can’t connect to our Droplet.

In putty, if I’m not mistaken you can add the SSH key directly in and have it loaded up in every connection attempt. You need to add the public key. The same goes for FileZilla.

Through SSH, you need to specify the exact location of the key. You can use the following:

  1. ssh -i /path/to/id_rsa root@YourDroplet.IP

Following up on my own question: I have temporarily fixed the issue by logging onto my droplet with the web console, setting passwords with the passwd command to both “root” and “django”, editing the /etc/ssh/sshd_config to change PasswordAuthentication to yes and PermitEmptyPasswords to no. Now I can log in using both ssh and fileZilla with a password instead of a public/private key pair. I’ve read that public/private key pairs are more secure than passwords, so I am still interested in hearing how to get public/private key pairs to work.