In my last role, SecureCRT was my console of choice, but my new employer doesn't offer it sadly.  So, instead, I've diligently being using PuTTY, a very popular freely available open source SSH client for Windows.

PuTTY is perfectly functionable out of the box, but I thought I'd share a few of the configuration tweaks I've made to make life a little easier.

Get your default settings right first

PuTTY lets you store configuration profiles for your most commonly used connections.  However, they're all based on the default profile so its vital that you get that right first!  I know its tempting to dive straight in, but this will save you a lot of time later!

So, before you make any changes, open the default profile by going to the Session section, highlight Default Settings and push the Load button.  I'd recommend you make a backup of this, so you always have the original defaults in case you ever need them.  To this, type Original Settings or something similar in the Saved Sessions box and hit the Save button.

Great!  Let the pimpage commence!

Don't automatically close windows

PuTTY can automatically close windows when you exit your SSH session.  By default, the Only on clean exit setting should be enabled, meaning that if your SSH session times out, but I sometimes exit one too many shells, meaning I lose any information that was on screen.  So, to disable the automatic closing of windows, just select Never in the Close window on exit section of the Session section.

Enable taskbar indication on bell

Many systems will trigger the system bell on error or when user input is required after a long running process.  You can enable an indication of these in the taskbar by selecting Taskbar/caption indication on bell in the Set the style of bell part of the Terminal - Bell section.

You can also choose to disable the sound if you like and just flash the window instead if you so choose (Visual Bell in the same page).

Sort out scrollback

By default, PuTTY will remember 200 lines of console output, which I've found to be lacking in many circumstances.  Given the vast amounts of memory available in most PCs, I'd recommend increasing this to 10,000 to ensure you never miss anything.  You adjust to your own needs by changing the Lines of scrollback setting in the Window section under Control the scrollback in the window.

In the same setting, you can also uncheck the Reset scrollback on display activity and check the Reset scrollback on keypress option instead.  As you might expect, this fixes one the most annoying "features" of many terminal applications.  By default, if you are scrolling back through console output, the terminal jumps back to the bottom whenever there's new text displayed.  That's remarkably annoying if you're trying to read the messages of a particularly verbose operation.  With the above settings changed, the terminal will only automatically jump back to your prompt when you start typing.

Fix that font

PuTTY is able to make use of ClearType which drastically improves the font quality compared to Anti-aliasing.  First, go to Window - Appearance and then look in the Font settings section in the middle.  Change Font Quality from Default to ClearType.  Now take advantage of this by choosing your favourite font.  Consolas 10-point or Lucida Console 9-point are a good place to start.

While you're there, increase the Gap between text and window edge to 3 pixels.

Character encoding

Most modern Linux systems support Unicode (UTF-8), so you might find you get better output (particularly for non-ascii) if you change the Remote character set to UTF-8 and choose Use Unicode line drawing code points in the Window - Translation section.

Colour is nice

I'll write another blog post about making your boring console vomit rainbows, but if you do happen do use something like ls --color, you may notice that the default colour scheme isn't great.  In particular, the dark blue used to highlight directories is a bit dark on a black background and Cyan is a bit disgusting.

To change the colours, go to the Window - Colours section and select the offending colour in the Select a colour to adjust list.  You might want to try the following:

  • Default Foreground (RGB = 195/195/195)
  • Default Bold Foreground (RGB = 255/255/255)
  • Default Background (RGB = 0/0/0)
  • Default Bold Background (RGB = 85/85/85)
  • Cursor Text  (RGB = 0/0/0)
  • Cursor Colour (RGB = 0/255/0)
  • ANSI Black (RGB = 0/0/0)
  • ANSI Black Bold (RGB = 85/85/85)
  • ANSI Red (RGB = 187/0/0)
  • ANSI Red Bold (RGB = 255/85/85)
  • ANSI Green (RGB = 0/187/0)
  • ANSI Green Bold (RGB = 85/255/85)
  • ANSI Yellow (RGB = 187/187/0)
  • ANSI Yellow Bold (RGB = 255/255/85)
  • ANSI Blue (RGB = 85/85/85)
  • ANSI Blue Bold (RGB = 90/130/255)
  • ANSI Magenta (RGB = 190/85/255)
  • ANSI Magenta Bold (RGB = 255/85/255)
  • ANSI Cyan (RGB = 0/170/170)
  • ANSI Cyan Bold (RGB = 0/210/210)
  • ANSI White (RGB = 195/195/195)
  • ANSI White Bold (RGB = 255/255/255)

Or, you can choose your own colour by hitting Modify; go ahead, I won't be offended.

Keep idle sessions alive

Most firewalls will kill off user sessions after a set period of inactivity.  Some are more zealous than others.  If you find that you connection keeps getting dropped, try using the Seconds between keepalives feature in the Connection section.  This will send a small packet of data to the server (called a keepalive funny enough) at regular intervals.  I keep mine set to 27 seconds, in the hope that most firewall administrators will choose 30 as their inactivity threshold.

Log in automatically

If like me, you're administering a corporate estate with centralised authentication, it might be nice if PuTTY automatically logs you in using your username and SSH key.

In the Connection - Data section, you can either supply a Auto-login username or instruct PuTTY to Use system username.  I personally use the latter as my Windows login is the same as my Unix account.

In the Connection - SSH - Auth section, you can provide the path to your SSH Private Key to allow password-less logins.  Simply hit the Browse button in the Authentication parameters part at the bottom and select the private key you generated with PuTTYgen (included in the main PuTTY installation).

Don't forget to save your defaults!

With PuTTY, you must explicitly save your changes back to the Default Settings profile.  To do so, go back to the Session section, highlight Default Settings in the list and hit Save.

Now, any new sessions will automatically be based on your system defaults.

To save a profile for one of your common servers, enter its hostname in the Host Name (or IP address) field of the Session section, enter a description in the Saved Sessions box and hit the Save button.  It should now appear in the drop down list, which you can just double click to use.