Recovering from a lost SSH Key File on Amazon EC2 Linux Instance

Recently I went to log in to an EC2 instance and I realized that I could no longer find the private key file that I needed to connect via SSH.  I looked around the Internet for recovery instructions and found some complicated pointers regarding creating a snapshot and then an AMI then using that to create a new instance.  This seemed like overkill, and I couldn’t get it to work when I tried it anyways (The new instance always stalled at 1of 2 Status Checks and I couldn’t connect).

On a whim, I decided that the key file had to be somewhere on the image and that I could probably find and replace it.  I was successful so I thought I would outline the steps here for others.

Warning, the following comes with a “Worked on my machine” guarantee, which basically means that you shouldn’t try this unless you understand what’s going on.

For the sake of keeping things straight, I’ll refer to the instance with the lost key as Instance A.

  1. Create a new instance with the same Linux build as the instance you need to access.  Create a new key pair.  Remember to actually save and back up the private key this time.  I’ll call this new instance “Instance B”.
  2. Shutdown Instance A.
  3. Detach the root volume from Instance A.  Note where it was attached, usually /dev/sda1
  4. Attach this volume on Instance B, note the mount point.  It will probably be something like /dev/sdf. Some Linux distros will actually use /dev/xvdf instead of sdf.

  5. Connect via ssh to Instance B.
  6. Run: sudo mount /dev/xvdf /mnt (using the device that was noted when you attached)
  7. cd to ‘/mnt/home/ec2-user/.ssh’  (this will be ‘/mnt/home/ubunto/.ssh’ on Ubuntu builds, may be different for other distros)
  8. Run: ‘sudo mv ./authorized_keys ./authorized_keys.old’
  9. Run: ‘sudo cp ~/.ssh/authorized_keys .’ (<- This is the magic.  We’re copying the Public Key from the .ssh dir of the currently logged in user to the correct location on the mounted volume.)
  10. ‘cd’ back to home
  11. Run: ‘sudo umount /mnt’
  12. Detach the volume from Instance B and then attach back to Instance A as /dev/sda1 (or other original mount point as noted in step 3).
  13. Now restart Instance A and you should be able to connect with SSH.
  14. After you’ve successfully connected back to Instance A, you can Terminate Instance B.

Running through sudo and doing chown and chgrp may not be necessary if your UID’s and GID’s match between Instance A and Instance B.

Simplify the Debate

As the election season continues to heat up, I’m consistently amazed by the ways that politicians choose to argue.  If you try to dissect the reasoning behind many fiscal conservative cries for spending cuts, it seems that they want to cut spending for the sake of reducing taxes.  This “tax-first” mentality may resonate with people who think they want more money in their pockets, but it leaves out the bigger part of the picture.

Every person participating in this debate needs to first evaluate the following two questions:

  1. What are the services I expect from my government?
  2. What am I willing to pay for those services?

Anyone who reflexively says that they don’t want the government to take any of their money should be called on to define what minimum services the government should provide and then their answer for question 2 should be reconciled with that level of service.  Anyone who comes up with a huge laundry list of services & social programs for question 1 should likewise be called to reconcile their answer to question 2 to a level reasonable to pay for those services.

Basically our entire complicated federal budget can be simplified to something like this:

(yes those bars are to scale, scary huh?)

Now there’s a large number of people who shout about the fact that the interest on our debt is going to bankrupt us.  Let’s split out interest spending on the above chart to see how big of a part of the problem that is:

(note for data nerds, the purple box gets smaller if you discount the portion of interest payments to the Federal Reserve that get kicked back to the Treasury)

I think it’s safe to say that no matter what your political slant that we’ve got a problem in that the spending column _way_ overshadows the income.

Now how we _fix_ the problem is the subject of many debates.  I think we collectively waste a lot of hot air shouting about how we’re going to fix things when we haven’t even come to a basic understanding about questions 1 & 2 above.  If you and I have a difference of opinion about whether the Federal Government should maintain the road outside my house, the interstate I drive on to get to work & the railways that bring coal to the power plant that provides power to my home, then we’re never going to agree on what marginal tax rate, and progressive tax structure would be appropriate to _fund_ those things.

Now in reality, question 1 _is_ the major divisive question in many political debates, but framing it as a question on tax policy first is dishonest.  Let’s discuss our differences on what we expect from the government and come to a legitimate compromise on what a reasonable level of government service is.  After we have agreed to a compromise on what the government should do, it should be possible, though not easy, to begin the debate on how we are going to pay for it.

No I will not alter links in a 4 year old post to help you optimize search results

Hopefully this isn’t too harsh.  I received a request today to alter an old blog post in a way that I can only assume is all about Search Engine Optimization.  The communication was mostly generalized flattery with a pass at being respectful of the integrity of my writing, but not enough that I think they actually took time to read through that specific post or any of my other writing.  I figured that the initial communication and my response might be interesting to those who’ve never had interaction with SEO folks.  Names and info removed.


From: [removed]
To: me
Date: Tue, 12 Jul 2011 18:10:32 -0400
Subject: Contact Request: Link in Blog Post

You have contact request!

Link in Blog Post
From: [removed]

Hi Rick,

I hope this message finds you well. I’m currently working on cleaning up [company name].com’s online presence and noticed you have a link to our site in your blog post. First off, thank you for finding us valuable enough to link to – we appreciate it! Part our clean-up process includes adjusting links to match the current title we’re using on our site outside of the [company name] brand name.

Your Post with Link: [link removed]

If you could please change the current link text from saying “[company name]” to “[company name] [important industry keywords]” it would be greatly appreciated.

Thanks for taking the time. Let me know if you have any questions on this change seeing as I fully want to respect your blog post as is as well. I look forward to hearing back!



Hello [removed],

I am not a big fan of altering links just to serve Search Engine Optimization. If your request below is really about cleaning up branding, I would gladly change the link but if I do so I would also add a nofollow tag. If [company name] prefers not to be linked to in this manner, or the original form from the blog post I wrote over 4 years ago, I’d gladly change the post to remove the link.

Just as a side note if you don’t know already, many bloggers are going to be defensive about this sort of thing. I’m not trying to be difficult, but taking time to edit a post just to serve your employer’s search rankings isn’t on my list of priorities.

I am a bit curious what sort of success rate you have with this type of request.


Rick Hallihan

Moving Contacts From a Verizon Feature Phone to Hotmail for Windows Phone 7

First, I have to explicitly state that the following process is not endorsed or supported by Microsoft or Verizon.  I have used it a couple of times successfully, but I can’t guarantee that your phone won’t spontaneously combust or otherwise cease to function if you follow the steps below.  If you have trouble, feel free to leave a comment below and I’ll do my best to help.

I have heard several stories lately from folks who are finally taking the plunge into the world of SmartPhones on Verizon (with the AWESOME HTC Trophy).  Some Verizon reps simply state that you can’t move contacts from the old to the new phone, but they helpfully print out a hard copy of the contacts from the old phone.  Others point to the Microsoft Article on Syncing Outlook Contacts with Windows Phone which isn’t very helpful if you don’t have or use Outlook.  I figured it would be worth putting up a post on the process I used.

The first step is to make sure your contacts are backed up with Verizon’s Backup Assistant from your old phone.  The process is different for different phones, but should be similar to the following.

On this feature phone, you select MENU, then Contacts, then Backup Assistant, then OK, and finally Backup Now. If you have not used Backup Assistant previously there are a few extra steps to set up a password, but they are pretty self explanatory. Verizon also has a great deal of documentation on their website at



Once your phone shows “Pending: 0” that indicates that all of your contacts have successfully been updated to the web.  You then need to sign in at 

If you haven’t already signed up for Verizon’s online account access, there will be extra steps here.




After signing in you should see a screen listing your contacts.  Click on “Select All”


Now click the drop-down next to “Select All” and select “Export Contacts”


You will be prompted to select a file download type, select “Outlook (CSV)”.  We’re not actually going to use Outlook, but this is a file format that Hotmail can import.


Your browser may prompt you for permission to download the file, select “Save” and make a note of the file’s location.


Once you have the MyContacts.csv file saved, go to and log in.  You will need to use the Primary Live Id that was first associated with your Windows Phone during setup.  From the main screen, select “Contacts”


On the contacts screen, select “Manage” then “Import” on the Menu. 


On the next screen select “Outlook”.  Again, we’re not actually using Outlook, that’s just the common language that both Backup Assistant and Hotmail know how to use.


Next click the “Browse” button and locate your MyContacts.csv file, then click the “Import contacts” button.


If everything has worked as expected your Hotmail Contacts should now include all the phone number from your previous phone.


A few points to note.  If you are using a Live Id that is not a Hotmail Address, you can still log in at Hotmail with that Live Id to access the contacts section.  Also, if you have been using Hotmail for a long time your Contacts folder might have a large number of entries that you no longer want.  The web interface has some good options for cleaning up and combining duplicate contacts, and is also a good place to sort through and clean out unwanted contacts.  Any changes you make on the web will be synced to your new Windows Phone.

Reading List: Linchpin

During some recent travel I had enough time to read Seth Godin's Linchpin, cover to cover in one sitting.  Well actually it was two sittings back to back with a layover in Dallas Fort Worth, but close enough.

Looking back, I almost wish I had stretched this over several days since the concepts take a bit of time to bake. Godin appropriately points out early in the book that the ideas will meet with resistance in your mind. In fact, one of the main premises in the book is this idea that we are all basically of two minds. Our creative social mind, and a nicknamed "lizard brain" that resists risk and sometimes sabotages our ability to put forth our best effort. My lizard brain was on full alert as I crammed through the book, but strangely that helped me to at least validate some of the theories in the book in real time.

This book is different from the other Godin books that I have read in that it wasn't prescriptive in how to accomplish a goal, reach an audience, or spread an idea. It was more of a manifesto, a plea for the reader as an individual to be different.  The different that Godin is pushing for requires breaking the rules of conformity and abandoning the repeatable cookie cutter factory-like methods that so many industries cling to in the name of quality.  He asks the reader instead to focus on human interaction and emotional nuance and makes a compelling argument that this will allow the reader to stand out, do more, and become indispensable to the organizations they serve.

Godin rounds out his argument with anecdotes of modern successful linchpins, historical perspectives about why the current career landscape encourages cookie cutter behavior but actually favors certain types of rule breaking, and even gives some basic evolutionary neurology backing for his theories.

This book is a great read if you are looking to stretch your mind a bit about what it takes to stand out, be successful and make a difference.

Reading List: Outliers

It took me two attempts to get through Outliers.  The first time I started reading this book, I had trouble getting past the fact that everyone focuses on the “birthday” success factor when talking about the book, and outside of sports I tend to think that other factors are more important to success.  I’m glad that I decided to re-tackle this book on the plane because the latter part of the book covered some of my own preconceived ideas about success, and added several new facets as well.

If you have heard of Outliers have most likely heard the correlation between professional sports “stars” and their birthdays.  Basically Gladwell highlights a correlation between those who are the oldest players  in a year-group, and those who grow up to be successful athletes.  This correlation is provable across many different sports, and Gladwell argues that the attention these players get from being just a bit better due to physical advantages means that they get more playing time, more praise and more practice, and that this cascades and accumulates, ensuring that they have more opportunity to excel and become experts.

The later part of the book brings in many other factors that drive “Outlier” like success.  There are a few other circumstance type drivers, such as the year when someone is born, or the historical experiences that a culture shares.  Gladwell also points out several Outliers that had happenstance advantages, such as being given a unique opportunity at a key point of personal development.

Gladwell revisits the idea of “time spent practicing” later in the book, but in more of a comparative way instead of the “10,000 hours to excellence” that was highlighted earlier in the book.  One such comparison was academic achievement in different countries, compared with the lengths of their school year.  This highlighting of marginal differences was much more compelling to me than the first part of the book.  I also appreciated that the end of the book discussed some ways we can eliminate the biases that our “normal” way of life imparts on us.

The last running theme that struck a chord with me was that success is not a matter of personal will, but rather a mixture of will, chance and opportunity.  I do paradoxically wonder what happens when more people are given the knowledge of what it takes to become an Outlier, and they set their will toward making it happen.