Skip to main content

SSH keys, my how I hate you sometimes.

So, earlier today I was setting up some SSH keys to be able to connect back and forth between various machines in my network.  Seems like a normal thing for a guy with a bunch of Unix machines around the house to do right?  Well, apparently it was more painful than I thought.

I had:
PubkeyAuthentication yes

I had the permissions right on all the files, on both the client and the server, yes, I checked this, and that.

So, here I am racking my brain, "why isn't this working", darn it.. what am I overlooking?  So I IM'ed a friend of mine, Richard Harman, who is the master of a bunch of things, one of the things is Linuxy, Unixy stuff -- at this point I'm at my wits end, and trying to figure it out, I am racking my brain.

Richard connects up to my computer, and he has the same problem (can't connect via SSH key), so it's obviously a server problem.

We start daemons in debug mode, looking at RPM packages (this particular server was running Fedora 10), heck, I was even looking at bugs in SELINUX as the culprit.  Nothing.

We noticed one line in particular that was bothering us..  every time someone tried to connect to sshd on the SERVER's SSHD debug line, it was trying to access /root/.ssh/authorized_keys.  No matter what the user.  Obviously, this isn't right.  I tested this out by moving my authorized_keys file to root's /.ssh directory and it worked right away.

After poking around a bit, Richard found the problem:
AuthorizedKeysFile     ~/.ssh/authorized_keys

Because, when SSHD starts up, the sshd_config file was expanding "~/" to the home directory, and since sshd starts as root..  the ONLY directory it was going to look in was /root/.ssh/authorized_keys

Richard changed this to:
AuthorizedKeysFile      .ssh/authorized_keys

It worked and life is fine now.  Two characters.  TWO.  (That I didn't put there, or at least don't remember putting there.)

Thanks Richard.

Comments

[...] Read more here: SSH keys, my how I hate you sometimes. [...]
Ashley Torres said…
Your blog keeps getting better and better! Your older articles are not as good as newer ones you have a lot more creativity and originality now. Keep it up!
And according to this article, I totally agree with your opinion, but only this time! :)
Ashley Torres said…
Your blog keeps getting better and better! Your older articles are not as good as newer ones you have a lot more creativity and originality now. Keep it up!
And according to this article, I totally agree with your opinion, but only this time! :)

Popular posts from this blog

Offset, Depth, Distance, and Within

Without going off the deep-end here and discussing every single Snort rule keyword, I just wanted to touch on a few modifiers that people sometimes misunderstand.  They aren't difficult, and hopefully after this explanation and a few examples, I can clear some of the air around these five modifiers.

The five modifiers that I am talking about are
OffsetDepthDistanceWithinnocaseThese five modifiers are not keywords of themselves, but rather they apply as modifiers to another keyword.  That keyword is "content". The content keyword is one of the easiest pieces of the Snort rules language as all it does is look for a particular string.  So for instance if I wanted to look for the word "joel" within a packet.  A simple:
content:"joel";Would allow me to do that.  The interesting part comes into play when you want to specify where inside of a particular packet you want the string "joel" to be looked for.  If you are running just a plain content ma…

Writing Snort Rules Correctly

Let me start off by saying I'm not bashing the writer of this article, and I'm trying not to be super critical.  I don't want to discourage this person from writing articles about Snort rules.  It's great when people in the Snort community step up and explain some simple things out there.  There are mistakes, it comes with the territory.  If you choose to be one of the people that tries to write Snort rules, you also choose to be someone who wants to learn how to do it better.  That's why I write this blog post, not to bash the writer, but to teach.

I noticed this post today over at the "Tao of Signature Writing" blog, and to be honest I glanced over most of it figuring it was a rehash of things I've already read or things that have already been written from countless people about "Here's how you write Snort rules!".  I scrolled down quickly skimming, not reading at all really, and noticed this part:
Now, let us look at the second questio…

Safari 5.1.4 now available

Safari 5.1.4 now available, fixes issues and improves performance | TUAW - The Unofficial Apple Weblog:


Improve JavaScript performanceImprove responsiveness when typing into the search field after changing network configurations or with an intermittent network connectionAddress an issue that could cause webpages to flash white when switching between Safari windowsAddress issues that prevented printing U.S. Postal Service shipping labels and embedded PDFsPreserve links in PDFs saved from webpagesFix an issue that could make Flash content appear incomplete after using gesture zoomingFix an issue that could cause the screen to dim while watching HTML5 videoImprove stability, compatibility and startup time when using extensionsAllow cookies set during regular browsing to be available after using Private BrowsingFix an issue that could cause some data to be left behind after pressing the "Remove All Website Data" button