Home

May 2008

S M T W T F S
    123
45678910
11121314151617
18192021222324
25262728293031
Powered by LiveJournal.com

HotSSH - this afternoon's few hours of PyGTK hacking

Improving the command line


One of the goals I had when starting the Hotwire shell project was to experiment with possible UI improvements to the command line[1]. The old terminal+shell combination gives quick access to a lot of the system, but the tty interface is very limited. I think Hotwire does successfully demonstrate that you can improve on things like ls while still retaining most of the general power of a traditional Unix terminal+shell.


How not to do it


One of the things I've wanted to improve since the beginning of the project was the ssh experience. Now when you think of "GUI SSH", you may be imagining something like Putty. No offense to Simon or any of the Putty developers who brought a very useful bit of Free Software to those of us periodically stuck on Windows, but Putty has a poor user interface. It's quite complex and confusing if you just want to connect to a remote computer; all of the useful options are mixed in with the options created for all of the 3 people in the world using Kerberized SSH or whatever, it doesn't remember which hosts I use most, etc.


What is HotSSH


HotSSH is my afternoon hack to create a thin SSH-specific runtime UI, written in ~500 lines of Python/GTK+. Here is how you are expected to run it (using e.g. bash):


$ alias ssh='/path/to/hotssh/bin/hotssh'
$ ssh example.com


In other words, I'm not breaking your workflow here by making you type into some crappy dialog. HotSSH is designed to be launched from your existing shell. You can keep taking advantage of any smarts your shell has, like intelligent host completion, history etc. So what does HotSSH do then? A picture is in order here:



OpenSSH icon, knows which host you're connected to, etc.

So when you type ssh hostname from your shell, it opens a new tab in your existing HotSSH window, instead of taking over your terminal. You get a nice OpenSSH blowfish icon in your task list instead of an undifferentiated terminal icon. In the future there will be more, here's the current TODO:



* Connect dialog, with completion from known_hosts
* Reconnect button
* Open SFTP button?
* <owen> ... doing a list down the left rather than tabs with both favorites and running ssh, and have running ssh bold
* Latency display (not sure how to implement this with OpenSSH)

And that's about it. Right now I'm tentatively planning to ship HotSSH with Hotwire, so Hotwire users get a nicer out of the box SSH experience, but I did make it a separate code base, so if you don't yet use Hotwire you can still take advantage of HotSSH. Here's the Git repository:



git clone http://submind.verbum.org/~walters/hotssh.git



Send any feedback, patches etc. you have for HotSSH to the Hotwire Discussion Group.



Relation to other projects


The Internet is full of projects which create terrible looking connection dialogs for SSH. I initially searched for a project like HotSSH trying to improve the post-connection aspect while still allowing you to use it as a drop-in replacement for the ssh command but didn't find one. It would be interesting though if someone added support for HotSSH to say SSHMenu.



[1] - In addition to creating a shell that by default does not lose all of your history if your computer crashes.


Comments

(Anonymous)

kerberalized ssh

I want to make it clear that more than 3 people in the world use Kerbalized SSH. For instance, at 3 places I've observed at, all large corporations, use of Kerberos for SSH was MANDATORY. This is so that it integrated into their existing Kerbalized infrastructure (Active Directory).

There are numerous benefits to policies such as this.

(Anonymous)

great

congrats!

Nice program, i guess Pexpect or something like that can be integrated so we can have better support for interpreters an other programs....

keep the good work!
One cheesy way to do latency estimation, if your ssh is set up to do ControlMaster sockets, is to just periodically run a ssh otherend /bin/true and time how long that takes. It's not completely accurate, and wildly non-portable in terms of what remote OSes you can estimate latency for, but it'd work for a zeroth-order approximation.

If you wanted to be more accurate, the best thing to do is probably extend ssh to do -O ping, which would just run through the motions of opening another channel to the remote end and then shut it down. This is actually a useful thing on its own, since right now all you have is -O check which only checks to see if the local end of a controlmaster session is available, and doesn't issue any network traffic at all.
Ah, setting up ControlMaster by default should also be on the TODO list. So if we had that, the idea of doing a ping would be nice.

Longer term it may make sense to skip OpenSSH and use say python-paramiko which would give us a lot more power.

(Anonymous)

JF

So why not show PuTTY some love and do these great improvements there instead of fragmenting the market? :)

Re: JF

I actually didn't know PuTTY had a Unix version. Wow, GTK 1.2. Hmm. Now that PuTTY is crossplatform that meshes some with Hotwire's goals.

Maybe I should hack on PuTTY. I dunno though...on Unix basically everyone is going to be using OpenSSH though.

I'll think about it =)

(Anonymous)

Colors

It looks nice.
It would also be cool to have different background-colors for different SSH-servers.
black background is not nice!

switching from black bg to white in my normal terminal and back hurts my eyes. please make the default theme the same as the user's gnome-terminal theme with maybe a pref to change it.

secondly, i don't see a way to pass options to ssh, unless i'm missing something. -X in particular is important to me.

agreed about putty's UI! truly a horror :)

witching from black bg to white in my normal terminal and back hurts my eyes.
Partially fixed - we now use the GTK+ theme colors by default, which is what gnome-terminal does. But what I really want to do is have per-host colors which should solve the problem.

secondly, i don't see a way to pass options to ssh, unless i'm missing something. -X in particular is important to me.

Fixed now, I think - though I couldn't actually get -X to work with my remote server, so I may be doing something wrong...

To get the updates, do: git pull
awesome!

the -X worked for me.

it would be wonderful to integrate this functionality into hotwire. i work regularly on at least 6 different unix accounts and manually managing the ssh is a big pain.

a killer feature for me would be to graphically/automatically manage public key authentication. manually copying the id_rsa.pub to .ssh/authorized keys is pretty painful.

i can imagine a feature that when enabled automatically copies your public key into each server that you log into. no more passwords!
Now 95% more integrated into Hotwire! So last night I added a Hotwire builtin for hotssh to Hotwire SVN. It's pretty cool, you get automatic hostname completion from ~/.ssh/known_hosts, etc.

The catch is the last 5%; I have to figure out the details of whether I want to ship them as separate tarballs or not, and that affects how they integrate. If you do try Hotwire from SVN, you can add code like this to say ~/.hotwire/plugins/hotssh.py:

import os
if os.access('/src/hotssh/bin/hotssh', os.X_OK):
os.environ['PATH'] = '/src/hotssh/bin/:' + os.environ['PATH']
import hotwire.builtins.hotssh

Adjust path as necessary.

This plugin bit won't be needed when this stuff is released though.

As for the public key - yeah, that's a good idea. Probably not too hard, just add a menuitem to exec scp ~/.ssh/id_rsa.pub $(current_tab_hostname)/.ssh/authorized_keys, well except you'd probably want to check if it currently exists.

(Anonymous)

man2hotwire, please...

man2hotwire is what quick learning of shell commands demands.

* looking up man pages is sick to gui-oriented brains
* navigating with cmd line is difficult, making the cmd line a "lofty holy grail" for the majority of linux *users* - "use only if you have to".
* you're damn good at it already, so I am not learning a new language to help with the code
* "autocomplete" or "google suggest" pop-up with multiple tabs if needed, and collapsed sections for rarely-used options/switches.
* a tree view widget might be immensely useful since you can hide lots of details in a collapsed node. if the user wants more detail than default, he goes on digging into it - the last node entry in the treeview should be "more..."
* maybe Kommander or Qt Designer/K Designer or Glade also might interest you (or anyone else in the group) after hotwire(python) succeeds.
* As for functionality, hotwire is almost a new platform to revolutionize the way newbies like me look at the cmd line. Think a little. You can do lots of fun things - new and old scripting, integration with sqlite, xbase and k/qt/gnome-ui....

My few cents.