How to fix ssh timeout problems

If you use ssh a lot, you may have noticed that your ssh session times out and you’re logged out every once in a while. Annoying isn’t it?

Read from remote host ocaoimh.ie: Connection reset by peer
Connection to ocaoimh.ie closed.

There’s a quick fix for that. Actually, there are 2 ways to fix it. You only need to do one of them so choose whichever one is easiest for you. You’ll need root access, so for most people it’s probably safer to do the client fix rather than the server fix.

  • On the server, login as root and edit /etc/ssh/sshd_config and add the line:

    ClientAliveInterval 60

    According to man sshd_config, this line,

    Sets a timeout interval in seconds after which if no data has been received from the client, sshd(8) will send a message through the encrypted channel to request a response from the client. The default is 0, indicating that these messages will not be sent to the client. This option applies to protocol version 2 only.

    Don’t forget to restart sshd on the server after you save the file.

  • The other way, and easier and safer way is for your desktop machine to send those keep alive messages. As root on your desktop (or client) machine, edit /etc/ssh/ssh_config and add the line:

    ServerAliveInterval 60

    That will send send a message to the server every 60 seconds, keeping the connection open. I prefer this way because I login to several machines every day, and I don’t have root access to all of them.

I knew I had blogged about ssh timeout problems before, but I hadn’t mentioned the client fix so it’s worth a revisit!

Fixing Ubuntu 8.10

I suppose you could say I’m a long time Debian/Ubuntu Linux user, but the recent upgrade to 8.10 completely messed up my desktop machine.

  • Sound was broken in Flash. That’s happened before and doing an aptitude install flashplugin-nonfree-extrasound fixed that, but from time to time sound would break and I’d have to killall -9 pulseaudio;pulseaudio -D to get it working again.
  • My shiny new Xbox360 controller refused to work correctly in Ubuntu 8.10. Despite assurances on various Ubuntu sites that a fully updated system should now work, it didn’t. Moving the analogue stick moved the mouse pointer.
  • Editing a spreadsheet in Open Office proved impossible as whatever key or action I last took would repeat if I used the cursor keys. Hit “a” and “a” would appear in every cell when the cursor was moved. I used the mouse and TAB a lot while working on my last VAT return.
  • I wrote a DVD+RW just fine on Monday, but 3 days later when I tried to erase it, Gnomebaker complained it didn’t have permission to access /dev/sr0 (I think). I tried to mount another CD and Ubuntu complained it couldn’t read ISO9660 CDs.

I tried recreating my user account in case that helped. It didn’t. The only way to fix my broken Ubuntu 8.10 was to reinstall from scratch. After backing everything up onto one of my external drives the install couldn’t have been easier.

So, now? Any problems? ‘Fraid so.

  • I had to install flashplugin-nonfree-extrasound to get sound working in Firefox and Flash. Yay, Youtube is sounding sweet again! No lockups yet.
  • My joypad still didn’t work, despite the fact I had upgraded everything. Thankfully this bug report came to the rescue. If your Xbox360 controller refuses to work in Ubuntu, try this:

    $ xinput list
    See which device number the Xbox controller has…
    $ xinput set-int-prop THATDEVICENUMBER ‘Device Enabled’ 32 0

    I’ll probably have to add that to the Gnome Session so it’s permanent.

  • OO.org works fine thankfully. That was a showstopper bug. I even considered using Mac OS X for a moment.

Backuppc is reinstalled and configured. It now has nice RRD graphs! I’m also blown away by the folder sharing in Nautilus. This might have been available in 8.04 but I never noticed. Sharing folders via SMB has never been so easy!

I haven’t reinstalled everything I need yet, but I’m happy that my desktop is working again.

2 candles and an apple pie

2 candles and an apple pie

So, I enter my 33rd year on this planet. Highlight of the day was our lunch in the Castle Hotel in Blarney where Adam was on his best behaviour and I was surprised with an apple pie and a rendition of “Happy Birthday” sung by my wife and 2 of the staff!

The burger I had for lunch was delicious too. Yum.

WordPress 2.6 Easter Egg

This is new to me, even though others have known about it for months. There’s a Matrix Easter Egg in WordPress 2.6 and in the betas of WordPress 2.7. To activate it:

  1. Edit a post.
  2. Scroll down to the revisions section of the page and click the latest revision.
  3. On the next page, scroll down again and select the same revision for comparison.
  4. The Matrix has you..

Danger !
Self-comparison detected.
Initiating infinite loop eschewal protocol.
Self destruct in… 3
2
1
Wake up, Donncha…
The Matrix has you…
Don’t let this happen again. Go Back.

WordPress MU 2.6.5

The beauty of Burnham Beeches

WordPress MU, the multi blog version of WordPress that runs on such sites as WordPress.com has been updated to version 2.6.5 to address an XSS vulnerability in the feeds offered to users.

More details will be forthcoming but for the time being, there’s also the WordPress.org announcement post.

This release also has a number of bug fixes, including a fix and improvements to rss caching. This is a required upgrade, so please install it as soon as you can.

After you’ve upgraded, check out the nominations for the 2008 WPMU Awards and vote for your favourite!

In related news, a new version of WP Super Cache is also available. This version hopefully fixes:

  1. Issues with clients seeing compressed pages incorrectly
  2. Cache clean up
  3. Warnings if Apache modules are missing
  4. Better support for WordPress MU. The wp-content/cache/.htaccess rules are now displayed on the admin page
  5. Better documentation on file locking
  6. WP Cache files are written to a temporary file first
  7. Use WP_CONTENT_URL in mod_rewrite rules generator

It also adds a number of filters:

  1. “supercache_dir” filter so the supercache directory can be manipulated. “wp_cache_key” cache_action to modify the key the wp-cache file is named after. Using both of these should make it easier for plugin authors to manipulate the cache based on user agent or other criteria. ie. iPhone theme? Unfortunately .htaccess rewrite rules will have to be updated manually.
  2. Added “wpsupercache_buffer” filter so the current page can be manipulated before being stored in the cache.

State of the Art by Spaceballs

This Amiga demo blew me away when I first saw it. There are better ones out there but I think the dancing figures were such an unusual feature at the time it struck a chord with a lot of people.

Check out the follow up demo, Nine Fingers and other releases by Spaceballs. Of course, you should grab the original disks for State of the Art and 9 Fingers and watch on a real Amiga rather than watching a low quality Youtube video!

Irish girls denied cancer vaccine

I haven’t been listening to the news much of late. I’m not sure when that started but even if the news is on in the background, the droning voice of the newscaster usually goes in one ear and out the other.

Unfortunately for the Irish Government, and Mary Harney in particular, Red Mum is making sure that everyone hears about their disgraceful refusal to administer a vaccine against cervical cancer to every 12 year old girl in the country. More on the Irish Times website:

Minister for Health Mary Harney this evening said the economic situation had “rapidly and seriously” deteriorated since the plan was announced in August. The vaccination against strains of the Human Papilloma Virus (HPV) would have cost an estimated €9.7 milliion annually.

The decision was immediately criticised by the Opposition and by the Irish Cancer Society, which asked Ms Harney to make a clear commitment to restore the vaccination scheme “at the earliest possible opportunity”.

Gavin has a clip taken from TV3 news featuring John Crown, a cancer specialist denouncing the decision:

So what can you do? Join the Facebook Group or send Mary Harney, the minister for health, pictures of your daughters. Blog about it, contact your TD and tell them you’re very unhappy with the situation. 9.7m Euro is pocket change in the budget of a country, even one in a recession.

While on the topic of vaccines, my wife was told that the area we live in, Blarney, is overrun with cases of childhood measles and mumps. I’m glad my little boy was vaccinated with the MMR.

Stix Bar in Beaconsfield

For lunch today we went to Stix in Beaconsfield. It’s a lovely restaurant in a picturesque area outside London, with a car park right next to it.

Before I go any further, the owners are related to Matt so I could be accused of being biased. Still we had a great lunch there. I ordered a burger, the others ordered various tapas portions and Adam had chicken goujons, chips and peas and hasn’t been as relaxed in a restaurant since he was a tiny baby and slept through our excursions to a local restaurant in Blarney.

If you’re ever in Beaconsfield, make sure you visit Stix and say hi to Suzy, Steve and Dan!

Styx Bar

Styx Bar

Styx Bar

Styx Bar

Make your WordPress plugin talk AJAX

This morning at BarCamp Cork I gave a short talk on how to add AJAX functionality to WordPress plugins.

Here are the example scripts I used during the talk. Rename the files to .php and install as you would normal WordPress plugins.

  1. helloworld1.txt – very simple and basic “Hello World” plugin.
  2. helloworld2.txt – script that will display the text “Hello World” using an AJAX request to get the text from the server.
  3. helloworld3.txt – script that displays “Hello World” text, and an “update” link that increments a counter via an AJAX http request.
  4. helloworld4.txt – script that displays a simple form. The form has one text box, a “Random” button and a “Save” button. Clicking the “Random” button makes a request to the server to get a random number. “Save” sends the number to the server.
  5. helloworld5.txt and rate.txt – “Rating” script to rate a post (Originally from here). Makes an AJAX request to the server with the rating. Server returns randomly generated stats on rating. Place rate.php in wp-content/

All scripts that operate in the Settings page in the Dashboard use a nonce for security and access admin-ajax.php when making AJAX requests. The wp_ajax_$POST[ ‘action’ ] hook is used to execute the actual code that does something useful.

The rating script uses wp_enqueue_script() to load the jQuery class.

If you’re an Irish O2 user, and use Twitter you might like to install the new Tweet Tweet WordPress plugin. Thanks to Enda who let me use his O2 account briefly, I created a plugin that sends Twitter sms notifications using the free O2.ie web texts. That means Meteor, Vodafone and O2 are now covered. Anyone want to contribute a plugin for 3?

PS. I was very proud that Automattic was able to sponsor BarCamp Cork, and hopefully most of the WordPress badges found good homes! Conor says 116 signed up for the event, with just over 100 showing up. That’s a great number to pull in for a Saturday tech event!

IMG_4625

IMG_4724

More photos can be found on pix.ie and flickr. Looks like Phil hasn’t uploaded any of his shots yet! Can’t wait to see what came of his afternoon photo session. I had to leave early and missed it unfortunately.
Discovered photos of my presentation. Yes, I used Vi (or Vim if you want to be pedantic) to give my talk!