2

I am trying to setup SSH-key authentication on Digital Ocean Cloud server. I first added my rsa_id.pub to my account and autoloaded it to the ubuntu droplet when I created it. There seems to be an error access the public rsa key but I changed all the file permissions in the /etc/ssh to 777(I know it's a bad idea). Any ideas?

-verbose log when ssh tries to authenticate

Apr  2 13:42:38 CarreFamilyHomestay-Webserver sshd[976]: Server listening on 0.0.0.0 port 22.
Apr  2 13:42:38 CarreFamilyHomestay-Webserver sshd[976]: Server listening on :: port 22.
Apr  2 13:43:49 CarreFamilyHomestay-Webserver sshd[1193]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Apr  2 13:44:54 CarreFamilyHomestay-Webserver sshd[1193]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=192.80.65.235  user=root
Apr  2 13:44:56 CarreFamilyHomestay-Webserver sshd[1193]: Failed password for root from 192.80.65.235 port 33463 ssh2
Apr  2 13:44:56 CarreFamilyHomestay-Webserver sshd[1193]: Connection closed by 192.80.65.235 [preauth]
Apr  2 13:46:17 CarreFamilyHomestay-Webserver sshd[1196]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Apr  2 13:58:54 CarreFamilyHomestay-Webserver sshd[951]: Server listening on 0.0.0.0 port 22.
Apr  2 13:58:54 CarreFamilyHomestay-Webserver sshd[951]: Server listening on :: port 22.
Apr  2 14:00:35 CarreFamilyHomestay-Webserver sshd[1118]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Apr  2 14:00:38 CarreFamilyHomestay-Webserver sshd[1118]: pam_unix(sshd:account): expired password for user root (root enforced)
Apr  2 14:00:38 CarreFamilyHomestay-Webserver sshd[1118]: Accepted password for root from 192.80.65.235 port 33274 ssh2
Apr  2 14:00:38 CarreFamilyHomestay-Webserver sshd[1118]: pam_unix(sshd:session): session opened for user root by (uid=0)
Apr  2 14:03:34 CarreFamilyHomestay-Webserver login[1042]: pam_unix(login:auth): check pass; user unknown
Apr  2 14:03:34 CarreFamilyHomestay-Webserver login[1042]: pam_unix(login:auth): authentication failure; logname=LOGIN uid=0 euid=0 tty=/dev/tty1 ruser= rhost= 
Apr  2 14:03:37 CarreFamilyHomestay-Webserver login[1042]: FAILED LOGIN (1) on '/dev/tty1' FOR 'UNKNOWN', Authentication failure
Apr  2 14:04:00 CarreFamilyHomestay-Webserver login[1042]: pam_unix(login:auth): authentication failure; logname=LOGIN uid=0 euid=0 tty=/dev/tty1 ruser= rhost=  user=root
Apr  2 14:04:03 CarreFamilyHomestay-Webserver login[1042]: FAILED LOGIN (2) on '/dev/tty1' FOR 'root', Authentication failure
Apr  2 14:04:22 CarreFamilyHomestay-Webserver login[1042]: pam_unix(login:auth): check pass; user unknown
Apr  2 14:04:22 CarreFamilyHomestay-Webserver login[1042]: pam_unix(login:auth): authentication failure; logname=LOGIN uid=0 euid=0 tty=/dev/tty1 ruser= rhost= 
Apr  2 14:04:37 CarreFamilyHomestay-Webserver login[1168]: pam_unix(login:account): expired password for user root (root enforced)
Apr  2 14:04:44 CarreFamilyHomestay-Webserver login[1168]: pam_unix(login:chauthtok): authentication failure; logname=LOGIN uid=0 euid=0 tty=/dev/tty1 ruser= rhost=  user=root
Apr  2 14:04:46 CarreFamilyHomestay-Webserver login[1168]: Authentication token manipulation error
Apr  2 14:04:53 CarreFamilyHomestay-Webserver login[1173]: pam_unix(login:auth): authentication failure; logname=LOGIN uid=0 euid=0 tty=/dev/tty1 ruser= rhost=  user=root
Apr  2 14:04:57 CarreFamilyHomestay-Webserver login[1173]: FAILED LOGIN (1) on '/dev/tty1' FOR 'root', Authentication failure
Apr  2 14:05:04 CarreFamilyHomestay-Webserver login[1173]: pam_unix(login:auth): check pass; user unknown
Apr  2 14:05:04 CarreFamilyHomestay-Webserver login[1173]: pam_unix(login:auth): authentication failure; logname=LOGIN uid=0 euid=0 tty=/dev/tty1 ruser= rhost= 
Apr  2 14:05:07 CarreFamilyHomestay-Webserver login[1173]: FAILED LOGIN (2) on '/dev/tty1' FOR 'UNKNOWN', Authentication failure
Apr  2 14:05:17 CarreFamilyHomestay-Webserver login[1173]: FAILED LOGIN (3) on '/dev/tty1' FOR 'root', Authentication failure
Apr  2 14:05:33 CarreFamilyHomestay-Webserver login[1173]: pam_unix(login:account): expired password for user root (root enforced)
Apr  2 14:05:59 CarreFamilyHomestay-Webserver login[1173]: pam_unix(login:chauthtok): password changed for root
Apr  2 14:05:59 CarreFamilyHomestay-Webserver login[1173]: pam_unix(login:session): session opened for user root by LOGIN(uid=0)
Apr  2 14:05:59 CarreFamilyHomestay-Webserver login[1225]: ROOT LOGIN  on '/dev/tty1'
Apr  2 14:07:10 CarreFamilyHomestay-Webserver sshd[1240]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Apr  2 14:07:17 CarreFamilyHomestay-Webserver sshd[1240]: Accepted password for root from 192.80.65.235 port 35403 ssh2
Apr  2 14:07:17 CarreFamilyHomestay-Webserver sshd[1240]: pam_unix(sshd:session): session opened for user root by (uid=0)
Apr  2 14:07:36 CarreFamilyHomestay-Webserver sudo:     root : TTY=pts/1 ; PWD=/root/.ssh ; USER=root ; COMMAND=/usr/bin/vim authorized_keys
Apr  2 14:07:36 CarreFamilyHomestay-Webserver sudo: pam_unix(sudo:session): session opened for user root by root(uid=0)
Apr  2 14:07:57 CarreFamilyHomestay-Webserver sudo: pam_unix(sudo:session): session closed for user root
Apr  2 14:08:36 CarreFamilyHomestay-Webserver sudo:     root : TTY=pts/1 ; PWD=/etc/ssh ; USER=root ; COMMAND=/usr/bin/apt-get install gedit
Apr  2 14:08:36 CarreFamilyHomestay-Webserver sudo: pam_unix(sudo:session): session opened for user root by root(uid=0)
Apr  2 14:09:08 CarreFamilyHomestay-Webserver sudo: pam_unix(sudo:session): session closed for user root
Apr  2 14:13:34 CarreFamilyHomestay-Webserver sshd[1316]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key

/var/log/auth.log

Apr  2 13:42:38 CarreFamilyHomestay-Webserver sshd[976]: Server listening on 0.0.0.0 port 22.
Apr  2 13:42:38 CarreFamilyHomestay-Webserver sshd[976]: Server listening on :: port 22.
Apr  2 13:43:49 CarreFamilyHomestay-Webserver sshd[1193]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Apr  2 13:44:54 CarreFamilyHomestay-Webserver sshd[1193]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=192.80.65.235  user=root
Apr  2 13:44:56 CarreFamilyHomestay-Webserver sshd[1193]: Failed password for root from 192.80.65.235 port 33463 ssh2
Apr  2 13:44:56 CarreFamilyHomestay-Webserver sshd[1193]: Connection closed by 192.80.65.235 [preauth]
Apr  2 13:46:17 CarreFamilyHomestay-Webserver sshd[1196]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Apr  2 13:58:54 CarreFamilyHomestay-Webserver sshd[951]: Server listening on 0.0.0.0 port 22.
Apr  2 13:58:54 CarreFamilyHomestay-Webserver sshd[951]: Server listening on :: port 22.
Apr  2 14:00:35 CarreFamilyHomestay-Webserver sshd[1118]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Apr  2 14:00:38 CarreFamilyHomestay-Webserver sshd[1118]: pam_unix(sshd:account): expired password for user root (root enforced)
Apr  2 14:00:38 CarreFamilyHomestay-Webserver sshd[1118]: Accepted password for root from 192.80.65.235 port 33274 ssh2
Apr  2 14:00:38 CarreFamilyHomestay-Webserver sshd[1118]: pam_unix(sshd:session): session opened for user root by (uid=0)
Apr  2 14:03:34 CarreFamilyHomestay-Webserver login[1042]: pam_unix(login:auth): check pass; user unknown
Apr  2 14:03:34 CarreFamilyHomestay-Webserver login[1042]: pam_unix(login:auth): authentication failure; logname=LOGIN uid=0 euid=0 tty=/dev/tty1 ruser= rhost= 
Apr  2 14:03:37 CarreFamilyHomestay-Webserver login[1042]: FAILED LOGIN (1) on '/dev/tty1' FOR 'UNKNOWN', Authentication failure
Apr  2 14:04:00 CarreFamilyHomestay-Webserver login[1042]: pam_unix(login:auth): authentication failure; logname=LOGIN uid=0 euid=0 tty=/dev/tty1 ruser= rhost=  user=root
Apr  2 14:04:03 CarreFamilyHomestay-Webserver login[1042]: FAILED LOGIN (2) on '/dev/tty1' FOR 'root', Authentication failure
Apr  2 14:04:22 CarreFamilyHomestay-Webserver login[1042]: pam_unix(login:auth): check pass; user unknown
Apr  2 14:04:22 CarreFamilyHomestay-Webserver login[1042]: pam_unix(login:auth): authentication failure; logname=LOGIN uid=0 euid=0 tty=/dev/tty1 ruser= rhost= 
Apr  2 14:04:37 CarreFamilyHomestay-Webserver login[1168]: pam_unix(login:account): expired password for user root (root enforced)
Apr  2 14:04:44 CarreFamilyHomestay-Webserver login[1168]: pam_unix(login:chauthtok): authentication failure; logname=LOGIN uid=0 euid=0 tty=/dev/tty1 ruser= rhost=  user=root
Apr  2 14:04:46 CarreFamilyHomestay-Webserver login[1168]: Authentication token manipulation error
Apr  2 14:04:53 CarreFamilyHomestay-Webserver login[1173]: pam_unix(login:auth): authentication failure; logname=LOGIN uid=0 euid=0 tty=/dev/tty1 ruser= rhost=  user=root
Apr  2 14:04:57 CarreFamilyHomestay-Webserver login[1173]: FAILED LOGIN (1) on '/dev/tty1' FOR 'root', Authentication failure
Apr  2 14:05:04 CarreFamilyHomestay-Webserver login[1173]: pam_unix(login:auth): check pass; user unknown
Apr  2 14:05:04 CarreFamilyHomestay-Webserver login[1173]: pam_unix(login:auth): authentication failure; logname=LOGIN uid=0 euid=0 tty=/dev/tty1 ruser= rhost= 
Apr  2 14:05:07 CarreFamilyHomestay-Webserver login[1173]: FAILED LOGIN (2) on '/dev/tty1' FOR 'UNKNOWN', Authentication failure
Apr  2 14:05:17 CarreFamilyHomestay-Webserver login[1173]: FAILED LOGIN (3) on '/dev/tty1' FOR 'root', Authentication failure
Apr  2 14:05:33 CarreFamilyHomestay-Webserver login[1173]: pam_unix(login:account): expired password for user root (root enforced)
Apr  2 14:05:59 CarreFamilyHomestay-Webserver login[1173]: pam_unix(login:chauthtok): password changed for root
Apr  2 14:05:59 CarreFamilyHomestay-Webserver login[1173]: pam_unix(login:session): session opened for user root by LOGIN(uid=0)
Apr  2 14:05:59 CarreFamilyHomestay-Webserver login[1225]: ROOT LOGIN  on '/dev/tty1'
Apr  2 14:07:10 CarreFamilyHomestay-Webserver sshd[1240]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Apr  2 14:07:17 CarreFamilyHomestay-Webserver sshd[1240]: Accepted password for root from 192.80.65.235 port 35403 ssh2
Apr  2 14:07:17 CarreFamilyHomestay-Webserver sshd[1240]: pam_unix(sshd:session): session opened for user root by (uid=0)
Apr  2 14:07:36 CarreFamilyHomestay-Webserver sudo:     root : TTY=pts/1 ; PWD=/root/.ssh ; USER=root ; COMMAND=/usr/bin/vim authorized_keys
Apr  2 14:07:36 CarreFamilyHomestay-Webserver sudo: pam_unix(sudo:session): session opened for user root by root(uid=0)
Apr  2 14:07:57 CarreFamilyHomestay-Webserver sudo: pam_unix(sudo:session): session closed for user root
Apr  2 14:08:36 CarreFamilyHomestay-Webserver sudo:     root : TTY=pts/1 ; PWD=/etc/ssh ; USER=root ; COMMAND=/usr/bin/apt-get install gedit
Apr  2 14:08:36 CarreFamilyHomestay-Webserver sudo: pam_unix(sudo:session): session opened for user root by root(uid=0)
Apr  2 14:09:08 CarreFamilyHomestay-Webserver sudo: pam_unix(sudo:session): session closed for user root
Apr  2 14:13:34 CarreFamilyHomestay-Webserver sshd[1316]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
  • This is probably cause by the fact that you've set the permissions as you have. Ssh won't accept world readable keys. Have you tried setting them back? – terdon Apr 2 '15 at 23:54
  • error: Could not load hostkey: /etc/ssh/ssh_host_ed25519_key does this file exists ? also, proper /etc/ssh permission is 755, not 777 (wrong(too open) permisson might prevent ssh/sshd from accessing file) – Archemar Apr 3 '15 at 11:20
1

Start over. Blow away your authorized_keys file.

  1. ssh-keygen (accept all defaults, don't use any passphrase)
  2. vi .ssh/authorized_keys
  3. Paste in contents of id_rsa.pub from the server you want to connect from.

Also, be very careful changing permissions on the cloud server. My answer is generic for linux, look at digital ocean details regarding SSH keys if they have some other process. AWS, for example, has their own system for managing keys.

  • Check digital ocean policy in case they have their own thing for keys. Backup authorized_keys before nuking!!!! – Baazigar Apr 2 '15 at 20:54
  • I spun up a new server and started over. I created new ssh keys and put them in the /home/usr/.ssh/ as well as the /root/.ssh directory on the laptop and the server. It started to work after I did that. Do I put the ssh public key in the /root/.ssh directory or the /home/usr/.ssh directory? – SomethingsGottaGive Apr 3 '15 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.