TurnKey Linux Virtual Appliance Library

How to log into Amazon EC2 instance and setup Putty for key based SSH logins

Beran's picture

Ok - I have the Amazon AMI all setup. I can log into my web interface file server.

I downloaded Putty.... I have used Putty in the past but its been a couple years.

I see the SSH key in the "SSH HOST KEY FINGERPRINTS"
How can I set Putty up to login automatically?
Also - can I setup a Webmin type of interface for setting up users and managing the mounting of data storage?
I did setup 10gig of storage but I was not able to login via SSH to "mount" the data.

I want to be able to set this server up do all my data is stored in the persistance storage from Amazon that I purchased.

Is there a how to for this?

TIA

Beran

Jeremy's picture

Ideas

I think you can create a shortcut to PuTTY that will log in automatically but I'm not 100% sure and have never used it. A quick google turned up this which looks like it could work.

Webmin should be able to handle users no worries. As for storage, it should be as easy as mounting the storage then including the folder as a SAMBA share. Not sure about how you would exactly go about mounting your cloud storage though. Once you have that sorted, adding it to the SAMBA shares is straightforward through Webmin.

Good luck

 

Beran's picture

thanks

Thank you JedMeister - that helped a little with Putty. I do not have it working yet though. Not sure where "Authorized Keys" are... there are only the ones I created on my PC.

How do I setup Webmin to work with my FileServer AMI?

 

Beran 

Liraz Siri's picture

You'll need to configure firewall security groups

By default Amazon EC2 has a restrictive firewall so you'll need to open a few ports as described in the tutorial in the "Opening additional ports" section. The port for webmin is 12321. Once you've opened it you should be able to access Webmin via https://your.amazon-ec2.ip.here:12321/.

Regarding putty, it's possible to configure automatic login but it can be a bit complex if you've never done it before. The process is the same on the Amazon EC2 instance as with a local VM so it's possible to experiment with a local VM first (e.g., using VirtualBox or VMWare Player) until you get the hang of it.

In a nutshell as as JedMeister mentions you need to edit authorized_keys and add the keys used by putty to the list recognized by the server. For root the file you need to edit/create is /root/.ssh/authorized_keys.

Here's a tutorial:

http://www.howtoforge.com/ssh_key_based_logins_putty

Note that from a Linux box adding keys is much simpler:

ssh-copy-id root@your-ip.com
It asks you for your root password and adds the key to the appropriate location.

Jeremy's picture

I'm not 100% sure

But from my reading of the page I linked to above, is that you create the keys locally then copy them onto the server (see step 2 from the above link). I'm at work at the moment but if I get a chance when I get home I'll have a play and see if I can get it to work. It would be nice to add this to the TKL documentation as its probably quite useful.

After a quick scan of the page, the only recommendation I would make re the instructions is I would alter the line that says:

vi authorized_keys

I would instead use nano rather than vi. Not that there's anything wrong with vi, its just that I think nano is more noob/Win user friendly. So the line would be:

nano authorized_keys

Other than that it looks like it should be ok. Only way to know for sure is to follow the instructions and see how it goes. If you are having specific problems ask and I may be able to help explain a little.

Webmin should not require any setup. In your web browser go to https://xxx.xxx.xxx.xxx:12321 where xxx.xxx.xxx.xxx is the IP/url of your site/server. Simple as that!

 

Amazon documents the process of using PuTTY to connect to EC2

http://docs.amazonwebservices.com/AmazonEC2/gsg/2007-01-19/putty.html

That link describes the process for using PuTTY from Windows.  You'll have to generate a PuTTY compatible key from your Amazon key pair.

Check out this post to get

Check out this post to get set up, use the PAGEANT utility to manage your private keys and essentially autologon, http://travislaird.com/post/Connect-to-your-Amazon-AWS-EC2-Linux-machine...

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)