SSH Private Key Authentication Tip

So easy to miss, but so important for SSH Private Key Authentication

I don’t allow password logins on any of my servers. Can only login via SSH key based authentication. No root login is allowed, and I specify every user that’s allowed to login via SSH, ie: me.

If you’re a regular here, you know I love DigitalOcean. They have a very nice tutorial on setting up SSH private key login, even walking you through creating SSH keys if you don’t already have one, and even adding that key to your DigitalOcean account.

None of that will be of interest to you if you already know how to generate SSH keys.

I’ll SSH into my new Droplet, only to be rejected. I immediately know why, because it’s happened so many times. It’s due to incorrect permissions on your Droplet, VPS, server, whatever.

For SSH private key authentication to work, the ~/.ssh/authorized_keys file and the ~/.ssh folder need specific permissions:

chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys

Run that, and then try logging in via SSH to your Droplet from your local machine. Should go this time.

If you still can’t login to your remote system, something else is likely wrong. If that’s the case, you’ll want to start at the top of the DigitalOcean post about setting up SSH private key authentication and just follow the steps.

After you’ve followed those steps, change permissions on the ~/.ssh/authorized_keys file again and on the ~/.ssh folder again. Like so from your terminal:

chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys

I’m curious…

Do you allow password logins over SSH?

View Results

Loading ... Loading ...

If you do allow password logins, I’d love to hear what scenario causes you to need to allow password logins. Let me know in the comments if you don’t mind.


WordPress Tip: Remove a Category from the WordPress RSS Feed

I recently setup The Events Calendar WordPress plugin on a few sites for work. The events are added as posts, so they show up in the WordPress RSS feed.

We didn’t want events showing in the RSS feed, this is the code I ended up with:

// Keep events out of RSS
add_filter('pre_get_posts', 'exclude_category_from_feed');
function exclude_category_from_feed($query) {
	if ($query->is_feed) {
		$query->set('cat','-'.get_cat_ID( 'Events' ));
	return $query;

Adding that bit of code to the functions.php file for your theme will prevent posts in the “Events” category from appearing in your RSS feed. You can obviously change “Events” to whatever category you want to exclude.
It can be extended too, not just limited to keeping a category out of the RSS feed. For example, to keep a category off the home page or archive pages, you can change this:

if ($query->is_feed) {

To this:

if ($query->is_archive || $query->is_home) {

That’s it! Hope you find it useful.


WordPress Tip: Redirect to Previous Page After Login

I work for a group of newspapers here in Iowa. We recently started moving these sites to WordPress. Site visitors must be logged in to view stories. They can see all the stories on the front page, but when they click through to a single story, they see a login form in place of the post/story content.

I needed to redirect users back to the page they were viewing after logging in. So, if a user was viewing a story called “Look at me now”, they’d need to be redirected back to that story after logging in.

To achieve this redirect to previous page after login, add the following code to the functions.php file for your theme:

I looked at a number of plugins to do this, but none seemed to offer this functionality.

A bit of searching on Google yielded this post at Taproot Creative. I modified the code on that post to set the redirect location to the referring page, and that was it!

Now users are redirected back to the story/post they originated from.

If you use a functionality plugin, which you really should, it’d make an ideal home for this snippet of code. So if you can, drop it in a functionality plugin instead of the functions.php file for your theme.

This Doesn’t Work!

For the code above to work, your login form must be embedded in one of you theme’s templates, or in a post or page.

If you’re providing users a “Login” button that takes them to the default login page (wp-login.php), this won’t work for you, users will be sent to the WordPress dashboard instead of the page they were at before hitting wp-login.php.

If the code above doesn’t work (ie: users are logging in at wp-login.php), the code below will allow you to define a page to redirect users to after login:

The example above will redirect users (including administrators) to /members/, and uses the home_url() WordPress function. So, if I were using this here, users would be redirected to

If you want to redirect users based on their role, like redirecting Administrators to the dashboard like normal, check out the example provided in the login_redirect filter documentation.


Tip: List of Voice Commands for Kinect on Xbox 360

I came across this list of voice commands for Kinect on the Xbox 360.

I wanted to document them here as well for future reference. I also get quite a bit of traffic related to Xbox 360 stuff, so someone else reading might find it useful.

Please be aware that this is not a complete list. This list mostly covers voice commands that let you interact with the Xbox 360 Dashboard, not specific games. There are, however, voice commands for some apps: Hulu Plus,, Netflix, ESPN and Zune.

You need to say “Xbox” before saying these voice commands.

Open Tray (only if there’s no disc inserted) -> Opens Tray
Kinect -> Opens Kinect Hub
Dashboard -> Takes you back to dashboard
ESPN -> Starts ESPN
Zune -> Starts Zune Marketplace
Video Kinect -> Starts Video Kinect
Trailer -> Starts Trailer
Dance Central -> Starts Game trailer
Play Game (disc) -> launches game
Next – > Takes you to next blade
Previous -> Takes you to previous blade
Sign In -> Signs you in
Achievements -> shows lists of achievements
friends -> shows friendslist
Face Id -> starts Face ID
Last Fm -> Starts Last FM

Voice Commands In Last FM:

Love -> hearts song
Ban – > bans song
next -> skips song
play -> plays playlist

Voice Commands for Last FM, Hulu Plus, Netflix, ESPN and Zune

fast-forward -> Fast forward a video or song
rewind -> Rewind a video or song
pause -> Pause video or song
play -> Play a video or song
next -> Skip to next video or song
previous -> Skip to previous video or song

If you’re aware of any voice commands that are missing, please leave a comment describing the voice command and I’ll get it added to this page.

UPDATE 1/3/2011:
I just came across the official Xbox Support “How to control your Xbox 360 console by using your voice” page. It doesn’t list all the voice commands listed above, hopefully they will update it with all the voice commands at some point.

UPDATE 1/17/2012:
Martyn Herb left a comment with a tip on how to turn your Xbox 360 off via a Kinect voice command. Before you can turn your Xbox 360 off, you need to say “Go to settings”. Once you’re at the system settings panel, you can then say “xbox turn off” to shut your Xbox 360 down.