Information Security Stack Exchange is a question and answer site for information security professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to SSH into my fresh Ubuntu 12.04 server. At the client I have deleted known_hosts. SSH to the host for the first time has it offering me an ECDSA key to verify. The problem is I know how to get the RSA key and verify it but I don't know how to get the ECDSA key.

How can I force SSH to prompt with the RSA key and store it if I approve?

I have tried:

ssh -o RSAAuthentication=yes user@server

Unfortunately this gives me an ECDSA key and the Are you sure you want to continue connecting (yes/no)? message.

share|improve this question

You can also tell the server what algorithm to use from the client (for example if you already have the rsa fingerprint written down and are physically far from the server)

  ssh -oHostKeyAlgorithms='ssh-rsa' host
share|improve this answer
up vote 9 down vote accepted

Don't use RSA since ECDSA is the new default.

On the server do this:

ssh-keygen -l -f /etc/ssh/ssh_host_ecdsa_key.pub

and record that number.

On the client you can SSH to the host and if and when you see that same number, you can answer the prompt

Are you sure you want to continue connecting (yes/no)?

affirmatively. Then the ECDSA key will get recorded on the client for future use.

share|improve this answer

Yes, OK switch to ECDSA soon, but in the meantime try this:

ssh -oHostKeyAlgorithms=ssh-rsa -o FingerprintHash=md5 user@example.com
share|improve this answer
2  
Can you explain how this is different from the top-voted answer? How is your answer unique? – schroeder Dec 18 '15 at 3:33
1  
Sure. A recent version of sshd switched from defaulting to RSA to defaulting ECDSA. It also appears to have updated the fingerprint hashing algorithm from MD5 to something more modern. I launch a lot of EC2 instances, and have written a script that runs on instance launch which tags the instance with the RSA host key's MD5 fingerprint. Until I update my tagging script, I have to specify both RSA and MD5 to verify my host keys. I'm guessing the OP might be having a similar problem. – bonkydog Dec 19 '15 at 21:54
    
You need to edit your answer to include these details – schroeder Dec 19 '15 at 22:04
    
@bonkydog is 100% correct - this was my issue as well. – Jon G Jul 22 at 18:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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