SSHMenu - easy organization of SSH connections

As I spend most of my days working on various web projects I often have to connect to a multitude of servers using SSH; development servers, production servers, database servers etc. To begin with I used basic bash aliases to keep track of the various ssh connections, since they were becoming pretty hard to keep in memory alone when they started using different ports for each server due to security reasons. My typical bash file had lines like the following in it to help me access the servers.

alias sshprod="ssh michael@production.server.com"
alias sshdev="ssh michael@development.server.com"

That method worked. I didn’t have to remember all the addresses, and if I forgot the command for a given server all I had to do was look in the bash file. But in February I found a better way to organize them in a Lifehacker post. They recommended using SSHMenu, a Gnome panel applet designed to keep track of SSH connections.

Screenshot of SSHMenu
Figure 1: A standard view of SSHMenu

On the surface it is a simple menu drop-down which organizes links to all the SSH connections you need, but it has one additional feature which makes it even better. Each SSH connection can have a terminal profile assigned so different connections can have different visual styles. This is a very nice way to make different connections easy to distinguish. I use this to tint the background colour so I easily can see what kind server I’m working on. It is also possible to set up SSHMenu to create connections that execute commands once it logs onto a server. The most common use of this is probably to easily tail log files on remote servers.

Installing SSH menu on Ubuntu is very easy since it recently became part of the standard universe repository for those of us running Ubuntu Hardy.

sudo aptitude intsall sshmenu-gnome

For those still on Gutsy there are instructions for how to update the repository on the SSHMenu homepage.

Once SSHMenu is installed you can add it to a Gnome panel by right-clicking on the Gnome panel, select Add to Panel… and then you’ll find SSH Menu Applet listed in the Utility section. Once the applet has been added to the panel you can start adding SSH connections to it from the Preferences window.

Screenshot of SSHMenu
Figure 2: Managing connections in the preferences window of SSHMenu

Here you can add new hosts to connect to, as well as organize them in groups and add visual separators where needed. A good thing about keeping the connections in separate groups is that you can open all the group’s connections at once, either with a separate terminal for each connection or as separate tabs within a single terminal window.

Adding a new host to the menu is done through the Add Host menu.

Screenshot of SSHMenu
Figure 3: Adding a new connection to SSHMenu

While most of the fields are self explanatory the Hostname (etc) hides some magic possibilities. Usually it will contain the server address, port number and user of the connection, but it can also contain commands to run on the server as I mentioned above. To create a connection dedicated to tailing a log file you could enter the following as the hostname:

www.example.com "cd /var/log/apache tail -f access.log"

The Geometry field can be used to ensure that the terminal windows start at the size and position that you desire, a nice addition since terminals have a habit of opening in a window that is too small to do any real work in. It is in the Profile drop-down at the very bottom you can set which profile to load when the new connection is started. I have a couple of profiles with different tint on the background, just enough of a difference in colour so it is easy to see that it is different from the standard black background. It makes the daily work sessions a bit more colourful, and I can easily see what server I am on - as I mentioned earlier.

Compared to using simple bash aliases these improvements might not seem like much, since a lot of the same things can be accomplished through some extra scripting, but when you use SSH every day the few seconds saved per connection adds up to quite a lot.

Related Posts:

Leave a Comment