April 2004 Archives
April 29, 2004

Googleplex fun


Fun day today! I've managed to do quite a bit today, but only early in the morning and late in the afternoon. Midday, exciting news hit the Googleplex.

I haven't seen the press noticing the pun our founders intended with the amount Google wants to raise: e * 10^9. Quite witty!

Posted by ovidiu at 10:55 PM |
April 02, 2004

Adding support for WindowMaker in RedHat 9


I don't like the window managers that come with Gnome or KDE. I typically prefer WindowMaker, a much lighter window manager that I'm using for years now.

To add support for it in RedHat 9, create a /etc/X11/gdm/Sessions/WindowMaker file that reads:

exec /etc/X11/xdm/Xsession wmaker

Create the /usr/share/apps/switchdesk/Xclients.wmaker file, if it's not already there. Make sure it points to your wmaker binary location. Since I compiled from source, mine is in /usr/local/bin/wmaker:

exec /usr/local/bin/wmaker

Make sure these files are executable:

$ chmod a+x /usr/share/apps/switchdesk/Xclients.wmaker
$ chmod a+x /etc/X11/gdm/Sessions/WindowMaker

BTW, on a fresh RH9 installation, if you compiled WindowMaker from source, don't forget to put /usr/local/lib in /etc/ld.so.conf, otherwise the shared libraries installed by WindowMaker will not be found. After you've done this, run ldconfig and make sure wmaker --version works fine.

Posted by ovidiu at 12:30 AM |
April 01, 2004

Setting up ssh-agent on Windows XP

Emacs | Open Source

As you probably know already, ssh-agent is an easy way to enter the passwords for your private SSH keys only once per session. On Linux and Unix systems, when using X-Windows, it is very easy to setup ssh-agent as the parent process of your window manager. In fact most of the Linux distributions start-up the window manager this way.

The way ssh-agent works is by setting up two environment variables, SSH_AUTH_SOCK and SSH_AGENT_PID. The first is used to communicate the location of the Unix socket domain on which ssh-agent is listening for requests. The second is used to identify the Unix process id of ssh-agent, so it can be killed by ssh-add -k.

These environment variables have to communicated to every process that wants to use ssh later on, so ssh can connect to the ssh-agent process and fetch the decrypted private keys. In the Unix parent-child process model, this works just fine. The ssh-agent does the work of creating the Unix socket domain and then forks a child process. In this process it first exports the two environment variables above, then exec the process - the window manager for X-Windows. This way all the processes that inherit from it will have these environment variables available.

On Windows this is not possible, since there is no way to interpose some other process before the window manager. This of course, assumes the same parent-child relationship of processes as in Unix. The alternative is to always start ssh-agent on some well-known socket. Below, I assume you use Cygwin, an excellent free-software Unix emulator for Windows.

There are few things you need to do. First in your Windows home directory (usually c:\Document and Settings\yourusername, make sure you have a .bash_profile that reads:

. ~/.bashrc

Then create a .bashrc file in your home directory, and add to it the following:

export SSH_AUTH_SOCK=/tmp/.ssh-socket

ssh-add -l 2>&1 >/dev/null
if [ $? = 2 ]; then
# Exit status 2 means couldn't connect to ssh-agent; start one now
ssh-agent -a $SSH_AUTH_SOCK >/tmp/.ssh-script
. /tmp/.ssh-script
echo $SSH_AGENT_PID >/tmp/.ssh-agent-pid

function kill-agent {
pid=`cat /tmp/.ssh-agent-pid`
kill $pid

Next, go to the Start menu, "Control Panel" -> "System" -> "Advanced" -> "Environment Variables" and add a new variable SSH_AUTH_SOCK, whose value should be /tmp/.ssh-socket. Hit OK to make the change persistent.

What happens next? The first time you open a bash terminal, an ssh-agent process is going to be automatically created. This process will listen on the Unix socket domain /tmp/.ssh-socket. Run ssh-add at the prompt to enter the password for your private key(s).

Now when you open another terminal, that will share the same ssh-agent process because of the SSH_AUTH_SOCK definition. Running ssh or any other command that uses ssh underneath will work without having to enter the password for your keys.

It will also work if you run a cygwin-ified version of XEmacs. Tramp, CVS or any other Emacs package that uses ssh will work just fine now.

The only requirement is for these programs to be cygwin-ified, otherwise the sharing described above doesn't work.

Posted by ovidiu at 11:35 AM | Comments (2) |
Cool stuff
  Arduino TinyWebServer: part 3 and part 2
More from me
Picture gallery
Copyright © 2002-2016 Ovidiu Predescu.