Home » Posts tagged "SSH"

Duplicati – an alternative for Rackspace Cloud Files Sync

I’ve been using Rackspace Cloud Files Sync, a little piece of software I’ve written myself, for some years now. I use it to backup my photo’s and movies I’ve shot over the last decade or so. The thing I like about it is that it syncs your local folder with a Cloud Files container. When skipping content checksums it’s fairly fast to only process the changes. Aside from backing up files it can also restore them.

Whilst it still serves my need I get in trouble if or when Rackspace changes their Cloud Files API. Way back when I wrote the software I wrote it in BlitzMax with the MaxGUI module (using the excellent LogicGUI designer) and my own htbaapub.rackspacecloudfiles module. Sure, I can update my module that wraps the REST API but I no longer have an up to date BlitzMax with all the required modules set up on a PC. When I took Maximus offline the most convenient way to install BlitzMax modules and their dependencies disappeared. In short, it’ll be a big hassle to get a working setup again capable of compiling a new version of Rackspace Cloud Files Sync.

But today I found out about a software called Duplicati! Duplicati is backup software that can create and store backups to several kind of storage solutions such as Rackspace Cloud Files, Amazon S3, Windows Live SkyDrive, FTP, SSH and more. It can also encrypt your backups.

After a short test using Duplicati with Cloud Files I’ve at least found a nice alternative for when my Rackspace Cloud Files Sync stops working. The only thing I’m missing though is doing a full backup and then sync the changes like my software does, but it appears that this is already supported in the 2.0 preview release of Duplicati. So it’s likely that if or when my software stops working I can use the 2.0 release of Duplicati.

cmder – Portable console emulator for Windows

Looks like there’s finally a decent replacement for the Windows command line tool! It’s called cmder and comes with Git (optionally) and a bunch of other great command line utilities such as curl, cat, ls, less and even ssh!

I did run into a couple of issues with the console not responding and also couldn’t use tmux during an ssh session. But that’s fine for now, I’m willing to give it a chance. You can get it at http://bliker.github.io/cmder/.

cmder

Using tmux – shortcuts

Even though Windows 7 is my main OS I use terminals a lot. I don’t mean the Windows command prompt in this case, though I actually use that a lot as well. The terminal I’m talking about now is Bash, which I use on my Raspberry Pi, VPS’s and virtual machines. To connect to these systems I use PuTTY.

The biggest benefit tmux gives is not having to open several terminals. Instead you use tabs (windows) or you split the current window. When I’m working on a project which has its own dedicated virtual machine (through Vagrant) I usually log in, create a 2×2 grid, setup 2 panes for tailing log files, another connects to MySQL and the 4th is available for regular terminal stuff.

Another nice feature is being able to detach your current session and return to it later. I do that with my Raspberry Pi for instance. Inside my tmux session I run irssi (an IRC client) and instead of having to reconnect all the time I just detach the session when I’m done, and recover it whenever I need to hop on IRC again.

Key in using tmux effectively is knowing the shortcuts. Memorizing them improves productivity a lot. So to help you get started I listed the main ones below.

  • ctrl+b % or ctrl+b " for pane splitting
  • ctrl+b space for changing pane orientation
  • ctrl+b n for next window
  • ctrl+b arrow keys for pane selection (older versions only support up/down)
  • ctrl+b , for renaming window
  • ctrl+b d for detaching session (close without shutting it down)
  • tmux a to resume a detached sessions

Am I missing any neat shortcuts? Let me know by dropping it in the comments.

Making PuTTY prettier and nicer to work with

PuTTY has been my go-to SSH client on Windows for years but I’ve found that it does require a couple of tweaks to turn it into the (almost?) perfect SSH client. Below are some tweaks to improve PuTTY.

Display characters the way it’s meant

For years I’ve put up with PuTTY displaying certain accented characters or other symbols in a bad and nasty way. This will cause tools like aptitude and tmux to look really awful. It was not long ago that I found that this behavior could be fixed by setting the proper charset. Go to Window > Translation > Remote character set and change it to UTF-8. Lines drawn by tmux have never looked so good. It also removed an annoying display glitch I was having with irssi.

If this doesn’t work make sure Bash is set to use UTF-8 by adding

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8

to your .bashrc.

More about setting up an UTF-8 environment.

Change the default font

By default PuTTY uses Courier New but I’m not really fond of it. Instead I use Consolas bold at 10pt. Using this font with these settings gives fuller text that’s better readable and nicer on the eyes. At least in my opinion.

Use PuTTYtray

I use PuTTYtray so I can set a transparent background. Just set alpha to 220 and the transparency is just perfect. PuTTYtray also has support for hiding your terminal in the system tray, but I personally don’t use that. If you don’t need either then I suppose standard PuTTY will be good enough. I do recommend to install PuTTY along side PuTTYtray though as it ships with some useful tools for key generation.

Change right mouse-button behavior

By default a click on the right mouse-button pastes anything you’ve got on your clipboard to the terminal. If you’re aware of this than it’s fine, but sometimes it can cause some inconvenience. Instead, change its behavior so a right mouse click will show a context menu which aside from pasting from the clipboard also adds some other useful shortcuts. You can find this setting under

Window > Selection > Action of mouse buttons and set it to Windows. The default is Compromise.

Full screen

If you use multiple screens (or not) you may already be resizing your terminal to fit the screen. Instead of full screen with the window border, title and scrollbar there’s also a full screen mode that removes this and uses the entire screen as your terminal space. To do this you need to enable this in

Window > Behaviour > Full screen on Alt-Enter. Doing so will let you use Alt + Enter to go to full screen.

Other settings?

In case I’ve missed any useful tweaks that improve usage of PuTTY I’d like to hear about them in the comments.

Using the IRC client irssi

Ever since I got my Raspberry Pi I’ve been using irssi for my IRC needs. Pidgin used to be my favorite client of choice for IRC and almost any other protocol. What makes irssi great is that I can keep it running on my Raspberry Pi and can resume my chat sessions wherever I am on whatever device (phone, iPad, iPod Touch, Laptop, Desktop) thanks to SSH and tmux.

These are some of the common shortcut keys I use a lot:

  • alt + p for page up
  • alt + n for page down
  • alt + left/right for switching tabs
  • alt + 0..9 for switching tabs

Aside from alt + p and alt + n you can also use PageUp and PageDown, but when I use my iPad via iSSH and my Bluetooth keyboard those keys aren’t available, and command + up / command + down don’t seem to work in iSSH.

And some other commands:

  • /who to list the users in the current channel
  • /join for joining a channel
  • /server for connecting to a server, this will replace your current connection though
  • /connect like the above, but keeps other connections intact
  • /help to show most commands, if not all

You can do a lot more with irssi than this. For example, you can write your own plugins. I haven’t had the need for this and I only use IRC for basic chatting really. If there’s a cool feature I’m missing out on I’d be glad to learn about it, so leave a comment if it’s worth mentioning.