Resolving SSH’s “Too Many Authentication Attempts”

Not long ago, I was trying to login to a new server and I was continually met with the error:

ssh X.X.X.X
Received disconnect from X.X.X.X: 2: Too many authentication failures for [username]

After ensuring that I wasn’t the issue and that the server wasn’t to blame, I asked my friend Google what could be happening.

This is what was happening. When you give the command ssh x.x.x.x, SSH tries to authenticate with that server using each one of your private keys before even presenting you with the option for interactive password authentication. This is the default behaviour – and I’m OK with that now that I know, but it is a bit quirky.

For this particular server, I did not have a key – I needed to use a password to authenticate. To stop the SSH client from attempting key based authentication, you can do one of two things:

  1. Pass a flag at connection time – -o PubkeyAuthentication=no.
  2. In your SSH config add the PreferredAuthentications password option for that host.

Also – if you ever run into issues with SSH, run it with -v (or -vv) and see what SSH is really doing behind the scenes.

Gists are Awesome

After an esteemed colleague sent an article about someone using gists as task lists, I thought it was about time that I publicly profess my love for the gist.

Gists are more or less limited Github repositories. According to GitHub, a gist is:

Gist is a simple way to share snippets and pastes with others. All gists are Git repositories, so they are automatically versioned, forkable and usable from Git.

A gist really excels when you need to share code with someone else. You pick up a lot of the benefits of normal repositories in addition to having it be highly disposable.

Creating a gist is as simple as going to gist.github.com and adding your content.

Forking

One of the differences between a gist and a full repository is that a gist that I create cannot be pushed to by you. Of course, you can clone it and commit locally, but when you try to push you’ll receive an error. This is regardless of whether the gist is private or public.

If you want to alter another persons gist, you must fork it and then clone & push to a gist that you own.

Clone, Pull, Push

In addition to the web interface, you can interact with gists through the command line.

# Clone a gist via SSH
git clone git@github.com:db53f70d54055e3fe5f3.git gists_are_awesome

Now if we change anything in that gist, we can push it back to GitHub.

# Commit the change
git commit -a -m "Updating post."

# Update gist
git push

Branches

You can also create branches (and push them to back to Github). I did a little bit of experimenting for this post and it doesn’t appear that you can view any branch other than master on the web interface. With that said, those branches are still available when cloning the gist.

# Make the branch
git checkout -b test-branch

# Push it
git push

Further usage

While I like the ubiquity of the web interface, I find having to open a web page an unnecessary step if the right tools are close at hand.

IDE

If you use Sublime (2 or 3) another wise move is to grab the gist plugin. Once it is setup, you can create a gist from a file or selected text in 2 keystrokes. The gist URL is copied to your past buffer automatically too. I find this makes sharing code a life saver.

Command line

I highly recommend grabbing the gist Ruby gem. It works both on the command line and in Ruby programs. I’m not a Rubyist – so I use it primarily on the command line.

Do you have any interesting ways of using gists? I’d love to hear about it.

Awesome Web Development Links Found This Week

I’ve come across some really interesting articles this week. Here’s a quick list of things I’d highly recommend spending a few moments reading this weekend:

  • International Freelancer’s Day – Sept 24-25, 2010
    • A free online conference, the only requirement is a quick registration. The thought of listening to “social media experts” is much out weighed by hearing Mike McDerment (of FreshBooks) speak.
  • EtherCodes - EtherPad for programming
    • Should be live at 2pm EST today.
  • Fixing Common Browser Issues: Dealing With Key Events
    • I’ve had this nagging issue with a key event, this helped shed a lot of light on it.
  • Css3 Generator
    • Even with all of the CSS3 resources available, I still found this to be to the point and helpful.
  • Everynote Site Memory – Another sharing button
    • As an Evernote user, I like the way you can customize this. You, the site owner, may select which parts of your page are clipped. You can even suggest which tags the resulting note gets!

Taggable Demo Video

In the comments of my last post on Taggable, John F asked to see a video of Taggable in action.

I felt like the example I created for the original post wasn’t very exciting, so I created one better. This demo shows how it could look if you used Taggable to save tags on the server as the users interacts with items.

Enjoy!