Linux.com

Feature: Tools & Utilities

Starting SSH connections simply with SSHMenu

By Ben Martin on June 18, 2008 (9:00:00 AM)

Share    Print    Comments   

SSHMenu adds a button to your GNOME panel that displays a configurable drop-down list of hosts that you have might like to connect to with SSH.

SSHMenu is packaged and available in repositories for both Ubuntu (as sshmenu-gnome) and Fedora (gnome-applet-sshmenu). Other SSHMenu packages available for both distributions do not include GNOME support. In those, the button for the SSH menu is started in its own window and an xterm is started when you wish to connect to a host with SSH. If you install the GNOME-aware SSHMenu packages, you can add SSHMenu to your panel by right-clicking the panel and choosing "Add to Panel..." and selecting the "SSH Menu Applet." When using the GNOME-aware SSHMenu, a gnome-terminal is started to handle your SSH connections, and you can select the profile gnome-terminal should use on a per-host basis. That lets you specify a font and background color in the terminal that can act as a reminder of which host that terminal is connected with.

Life without SSHMenu

If you are using GNOME, you can mimic much of the functionality of SSHMenu using the Application Launcher panel applet to show a personal menu of SSH connection options. For example, you can run alacarte to edit your GNOME menus, creating a new menu for SSH connections and new menu items in that menu for each SSH connection that you wish to start. You can then add the menu itself to the panel to get SSHMenu type functionality (your SSH connections all in a menu with possible submenus) and also add individual SSH hosts that you connect with often directly to the panel itself for single-click access.

Using gnome-terminal profiles in the above setup lets you specify different font and color parameters for each SSH connection. Your launchers execute something like:

gnome-terminal --window-with-profile=me@overthere.example.com

where the gnome-terminal profile me@overthere.example.com uses the custom command ssh me@overthere.example.com to automatically connect terminals created in that profile to the remote host.

The maintenance headache of having explicit profiles for each user and host combination grows rapidly. If you are running a collection of virtual machines for testing purposes, having a single gnome-terminal profile and using SSHMenu to connect as specific users and hosts might be a quicker option.

Life with SSHMenu

With SSHMenu, you don't have to set up individual gnome-terminal profiles for each host. You can still use profiles to set different font and color characteristics for connections, but you can group many connections to use the same gnome-terminal profile -- for example, a single profile that sets a unique background color and font slightly larger to remind you that you are the root user on a given connection.

There's a downside of not having a specific gnome-terminal profile for each SSH connection. When using SSHMenu to start your connections, you will find that when you hit Control-Shift-T to get a new tab, you will not be connected to the remote host with SSH in the new tab. If the gnome-terminal had an explicit profile, with the custom command for the profile set to SSH into the remote host, then any new terminal tab or window created with that profile would automatically be connected to the expected host with SSH.

How much this affects your usage depends on how often you use Control-Shift-T to get a new tab, or right-click a gnome-terminal window and select Open Terminal. If you start new terminals in either of these ways with any regularity, you might get a little frustrated by the new terminal having the same background color but not being connected to the expected host.

The preferences window of SSHMenu is split into Hosts and Options. The options tab allows you to enable tear-off menus, or open all the connections in a given submenu in windows or as tabs in the same new window.

The hosts tab lets you configure your SSH connections and arrange them into submenus, with the possibility of adding separators between menu items. For each SSH connection you add to your SSHMenu, you can configure the name given to it in the menu, what the window geometry will be for the terminal window started for that connection, what gnome-terminal profile to use for the connection, and the hostname to connect to. The hostname can include user@host and any options to the ssh command that you wish to pass in for the connection.

A great way to set the window geometry is to click the test button to spawn a gnome-terminal connected to the host, resize and relocate the gnome-terminal to where you want, then click the grab button in the SSHMenu Host Connection Details window and click on the gnome-terminal. If you have a submenu with a related collection of SSH hosts, and have set up the window geometry to place each of the gnome-terminal windows for the connections in that submenu in non-overlapping places on your screen, then SSHMenu's "Open All Windows" option for the submenu is very useful.

SSHMenu is written in the Ruby language and includes good support for adding extensions by specifying your own custom subclasses. A walkthrough is provided for adding telnet support, which could be used to add custom sftp client support and other communication protocols. The SSHMenu Hacker's Guide includes various hacks that can be used to customize SSHMenu, leading up to full-scale embedding of an SSHMenu in another application.

Wrap up

I tend to create new terminals from existing ones using Control-Shift-T often enough to get annoyed when I find that the new tab is not automatically connected through SSH to the same host as the original one was. However, SSHMenu makes up for that by letting you set up collections of SSH connections and, with a single click, open groups of related connections in either a collection of new windows or in a collection of new tabs in a single new window.

Ben Martin has been working on filesystems for more than 10 years. He completed his Ph.D. and now offers consulting services focused on libferris, filesystems, and search solutions.

Share    Print    Comments   

Comments

on Starting SSH connections simply with SSHMenu

Note: Comments are owned by the poster. We are not responsible for their content.

Starting SSH connections simply with SSHMenu

Posted by: Anonymous [ip: 194.36.2.101] on June 18, 2008 11:17 AM
i have using this on my laptop, but today i tried powertop, and sshmenu was causing 100 wakeups a second (which is pretty bad). I think it is fixed in latest (or maybe svn) ruby-gnome2. (i am on ubuntu hardy)

if you need battery life more than this handy menu, install powertop, and check if your sshmenu is a problem.

#

Or just use Putty...

Posted by: Anonymous [ip: 206.61.236.221] on June 18, 2008 02:06 PM
The Putty SSH client has been doing this for a long time now. It may not be Gnome-based and is not as polished, but it gets the job done right.

Putty offers connection profiles in a list menu, with lots of configuration options for those that need tweaking, and Telnet is supported out-of-the-box.

It also allows you to set up VPN tunnels that forward other communications through the SSH session. Not needing an additional VPN client software is a pretty sweet deal.

Tech_fixer.

#

Starting SSH connections simply with SSHMenu - significant advantage?

Posted by: Anonymous [ip: 204.50.208.4] on June 18, 2008 02:37 PM
I alway have at least one term open and can type ssh user@place faster than selecting clicky clicky buttons. Is there an advantage to using this beyond having the machine remember your remote addresses in a list?

It seems like it will still have to open a term window since ssh is a cli tool.

(Not to be disparaging at all. Mor choice is always welcome and I'll keep this in mind for jobs where it is better than opening connections by hand.)

#

Re: Starting SSH connections simply with SSHMenu - significant advantage?

Posted by: Anonymous [ip: 204.50.208.4] on June 18, 2008 02:41 PM
Me again; found it. SSHMenu will open multiple connections off a single click where I would toss multiple " ?term -c 'ssh user@location' & " into a single bash script.

#

Re: Starting SSH connections simply with SSHMenu - significant advantage?

Posted by: Anonymous [ip: 66.192.83.83] on June 18, 2008 03:51 PM
I agree. Except for sites that use difficult to remember hostnames, I've never understood the desire to store hosts in PuTTY.

Creating an intuitive hostname scheme is required though. Some places aren't aware of this concept. I'm still dealing with some lusers who insist on using hostnames vs DNS aliases.

#

Re: Starting SSH connections simply with SSHMenu - significant advantage?

Posted by: Anonymous [ip: 74.69.65.169] on June 18, 2008 04:25 PM
can type ssh user@place faster than selecting clicky clicky buttons


No, you can't, you're lying. No one believes you can stop what you're doing, switch to another term, and type user@place than I can go "click, click", so stop trying.

#

Re(1): Starting SSH connections simply with SSHMenu - significant advantage?

Posted by: Anonymous [ip: 65.161.188.11] on June 19, 2008 07:07 AM
Hi
I disagree, yes he can !, I can !: ssh + bash with autocompletation makes the job even easier since you can autocomplete the hostnames once you add them to the /etc/hosts file. Anyway you have to do it in some place, either the application or the host file.

Saludos

JARCH

#

Re(1): Starting SSH connections simply with SSHMenu - significant advantage?

Posted by: Anonymous [ip: 204.50.208.4] on June 19, 2008 01:26 PM
"No, you can't, you're lying. No one believes you can stop what you're doing, switch to another term, and type user@place than I can go "click, click", so stop trying."

I usualy use KDE unless working outside X entirely. In the first case, I have keyboard commands mapped to switch desktops or open a term directly. In the later case, alt+F# is even faster. I usually have one desktop space dedicated too four terms that open during the startx (we don't all default to GUI) process so they are just there when needed. My WM us usually just a to support multiple terms on the screen at once when I'm doing real work rather than mucking with firefox or amarok.

Really? I'm lying about being able to hit a maximum of two key commands or simply alt-tab and type "ssh user@place" [Enter] faster than removing my hand from the keyboard, reaching for the mouse and pointing through a menu list? Please..

You may also notice that my next comment after that points out the advantage of the pointy clicky menu and admits that I'm happy about having further choice even if I don't make use of the option currently.

It's fun posting anonymously huh..

#

Re: Starting SSH connections simply with SSHMenu - significant advantage?

Posted by: Anonymous [ip: 66.183.16.22] on June 18, 2008 09:10 PM
"I alway have at least one term open and can type ssh user@place faster than selecting clicky clicky buttons. Is there an advantage to using this beyond having the machine remember your remote addresses in a list?"

I was wondering about the same thing.

You can simplify the "ssh user@place" even further:
- you can specify the default user for specific hosts in your .ssh/config file, so now you only have to type "ssh place"
- also, you can enable tab completion for host names (you have to configure ssh not to encrypt host names saved to .ssh/known_hosts) and then the command becomes something like "ssh pl<tab>"

I was not aware of the possibility to use terminal profiles to connect to ssh servers, that sounds like an interesting option. It happens quite often that I open a new tab and then connect to the same server, but then quite often I would open a new tab for something totally different, so not sure, I'll have to use it for a while.

#

Re(1): Starting SSH connections simply with SSHMenu

Posted by: Anonymous [ip: 204.50.208.4] on June 19, 2008 01:32 PM
Hehe.. true and if you use certs instead of password authentication the remote cli just pops up, no further typing after the initial "ssh place"; not to mention the increase in security posture.. oh how I love SSH

#

Starting SSH connections simply with SSHMenu

Posted by: Anonymous [ip: 24.248.89.66] on June 18, 2008 03:12 PM
I just use Gnome-Terminal-Launcher and set up a bunch of profiles. Pretty easy.

#

Starting SSH connections simply with SSHMenu

Posted by: Anonymous [ip: 201.244.141.45] on June 19, 2008 02:49 AM
It is even easier to read the manual pages and edit your ~/.ssh/config file to set up aliases for your hosts, including user, identity keys, encryption algorithms and almost anything you may want on a host to host basis. I have a fair bunch of hosts to connect to and I use a different key pair to connect to each. I just type "ssh host1" or "ssh host2" and I'm done (barring typing the password to unlock the private key).

#

Starting SSH connections simply with SSHMenu

Posted by: Anonymous [ip: 60.234.224.18] on June 19, 2008 11:08 AM
As the author of SSHMenu I'd like to say thanks Ben for the comprehenive writeup!

To the people who say using the command-line is easier, I say great! Use the command-line. This might not be the tool for you and as far as I know nobody is trying to force you to use it. I happen to be a command-line junkie too and I wrote this tool because it worked better for me than the command line. The main things it gives me is consistent window positioning and sizing as well as setting the background colour to indicate which windows are on production servers vs staging servers vs development servers. But if shell aliases etc work better for you then do that.

Another feature of SSHMenu that's specifically targetted at comman-line junkies like me is the bcvi integration.

#

Re: Starting SSH connections simply with SSHMenu - as one of the cli users

Posted by: Anonymous [ip: 204.50.208.4] on June 19, 2008 01:36 PM
As one of the cli users in the comments above, I'd like to say thanks for scratching that itch and producing SSHMenu. The choice is what makes FOSS strong and there will be plenty of cases where your bit of code is the best choice.

#

Starting SSH connections simply with SSHMenu

Posted by: Anonymous [ip: 65.102.244.141] on June 19, 2008 02:23 PM
Why does SSH causes people to reinvent the wheel over and over again? There already are many ways, as other posters have the described, to do pretty much what SSHMenu aims to do. Sure, having choice is good, of course; but it would be better if people were to devote their efforts to coming up with solutions to real problems, rather than coming up with solutions looking for a problem to solve.

#

Re: Starting SSH connections simply with SSHMenu

Posted by: Anonymous [ip: 124.148.125.28] on June 20, 2008 07:54 AM
Why shouldn't people devote their open source coding efforts to whatever they want. Its a popular thread to say that open source developers should write product X or use solution Y but isn't it a bit conceited telling people how they should spend their development time.

#

my 2 cents

Posted by: Anonymous [ip: 87.165.88.112] on June 23, 2008 05:49 PM
I think the do reinvent the wheel, because (for some people) the CLI might be frightening. The last time somebody watched me doing my "CLI-Magic" they said "duuuh, I don't get this" OR "this is way too complicated". This happens to me a lot _and_ it happens that I have to hear that, when I'm just switching directorys and listing files :D. And I am really not the guy who can use bash to its limits. So it might be easier for them to just "click---write---click---move---click" through their life.

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya