Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have an Amazon EC2 Windows 2008 R2 server and I've been trying to get SSH working on it. I installed FreeSSHd after having numerous problems with CygWin/OpenSSH, but now I'm not sure how to load the public key from the instance. I can see under EC2 > Key Pairs that my key named "test" is there, but I can't find any option to download the public key. In the information about credentials, it says that the SSH public key is stored on the instance, but doesn't say how, and on the security credentials portal, it has some of my key pairs with 20 character IDs generated by AWS, but none are named "test" like the one associated with my instance. How can I find my public key on my EC2 server?

Edit:

An AWS Architect informed me that the public key is not saved/stored on a Windows Server, only on a Linux instance. So the answer is that the key used for decrypting the Remote Desktop password isn't anywhere on the server and a different key pair must be used for SSH.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Short answer:

The AWS console can generate a keypair for you and provide you with the private key which you will then download and use upon connection (for instance by loading with Pageant and putty and ssh-ing into the machine)

Step-by-step:

From the documentation:

To generate a key pair:

  1. Open the Amazon EC2.

  2. Click Key Pairs in the Navigation pane.

  3. The console displays a list of key pairs associated with your account.

  4. Click Create Key Pair.

  5. The Key Pair dialog box appears.

  6. Enter a name for the new key pair in the Key Pair Name field and click Create.

  7. You are prompted to download the key file.

  8. Download the key file and keep it in a safe place. You will need it to access any instances that you launch with this key pair.

Read More:

For more information, check out the part in Getting an SSH Key Pair about "How to Generate Your Own Key and Import It to AWS" or "How to Have AWS Create the Key Pair for You"

share|improve this answer
    
low rep prevented me from posing all the links. so here's the documentation, and here's the link to EC2 Console –  tutuDajuju Jul 12 '12 at 20:56
    
I had read the keypair documentation and looked in the EC2 console, and I have the private key on my personal computer, but I can't figure out how to download the public key. The "test" keypair has already been generated and I can use it to log in through Remote Desktop, but I'm not sure how to download/find the public key in a file on the server. –  FlyingMolga Jul 12 '12 at 21:10
    
I'm not sure why you'd want to download the public key... The idea behind key-pair authentication is explained here. Amazon basically generates the key for you so you won't have to upload the public key to the EC2 machine but rather just download the private key to your machine (usually it's the other way around). –  tutuDajuju Jul 12 '12 at 21:15
    
I need to connect to the server via SSH, and I'm trying to figure out how to load the key into an SFTP client so that I can authenticate. I don't need to take the public key off of the server, I just need to find the file on the server. –  FlyingMolga Jul 12 '12 at 21:19
    
If you want to connect with SFTP from machine A (your PC) to machine B (EC2) then all you need to do is load the private key that you downloaded from AWS console into Pageant (get here), open WinSCP and login to machine B. If on the other hand you want to use machine B as the client and log-in to machine A or even C ... then you'll have to generate a key-pair on B and follow the instructions that I sent you in the comment above –  tutuDajuju Jul 12 '12 at 21:23
show 1 more comment

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.