Wednesday, 14 May 2008

SSH X11 forwarding for other users

Forwarding X11 requests from a remote machine to your workstation is often very useful, especially if you have the habit of using graphical clients, or if you're just forced to use a tool that expects a X server to exist. Yet, when you change to a user other than root, the forwarding will most likely fail. Here's how you can fix this:

  1. Connect to the remote system.
  2. xauth list
  3. Select the line outputted by xauth, copy it to buffer... If there are multiple lines, use the one that related to your session -- or try xauth list $DISPLAY
  4. Su or sudo into the other user.
  5. xauth add (paste the line from xauth)
From there, you'll be able to run just about any program. If you have errors, or the command hangs there, verify that the DISPLAY variable is properly set.

1 comment:

Anonymous said...

You my man, ROCK!