Remote X11

I have a main Linux box running Mandriva 2009.1, and I wanted to set up Linux on a second computer in such a way that I could be sitting at the second computer running programs off of the main computer — kind of like remote desktop, only this would be program by program instead of the whole desktop.

I had seen that magic work before (you just ssh to the other computer and run the command, and it shows up in your local display — I think there’s some kind of forwarding going on); but this time I wanted to add a second kind of magic: I wanted the secure shell session to happen without having to drop to a shell and type a password interactively.

I had seen both kinds of magic working before, just not simultaneously.

Magic A

The magic of running a ssh session without having to interactively type a password is explained on the ssh man page.  It involves the following steps:

  1. On the second computer, I ran ssh-keygen (with no master password, for now anyway).  This created (among other things) a ~/.ssh/id_rsa.pub file
  2. I copied the contents of the id_rsa.pub file to my home folder on the main computer in a new file called ~/.ssh/authorized_keys .
  3. I set the file permissions on the authorized_keys file so that only my user had any permissions (otherwise ssh ignored the file and prompted interactively for a password anyway!)

Now I could ssh from the second computer to the main computer without typing a password.  The stage was set for Magic B:

Magic B

Now on the second computer I made shortcuts for Firefox and Thunderbird on the main computer.  The commands in the shortcuts were:

ssh -f maincomputer mozilla-firefox

ssh -f maincomputer mozilla-thunderbird

Now when I click on those shortcuts, the programs run on the main computer but are displayed on the second computer, only slightly slower than on the main computer (maybe I’ll upgrade to a Gigabit internal network sometime).  Nice!

Advertisements

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s