Wednesday, July 20, 2011

X11 forwarding on a mac

For all of you who are wondering how X forwarding works when using a mac. To be honest it is quite simple. First make sure you have a local installation of X11 on your mac, a very simple step by step guide is created for this by the Ohio State University

(0)Insert your Mac OS X install disc. (If you have two discs it will be the "Install Disc 1")
(1)In the window that pops up double click on "Optional Installs" (You may need to scroll down)
(2)In the new window that pops up double click on "Optional Installs.mpkg"
(3)In the installation window click Continue.
(4)Read through the License Agreement and choose Continue if you agree.
(5)Click the triangle next to "Applications" in order to expand the directory.
(6)Put a check in "X11".
(7)Click Continue.
(8)Click Install.
(9)Wait for the installation to complete and then click Close when it is complete.

Now we have set this up you can connect to a remote linux server as done in the example below.

johan-louwerss-macbook-pro:~ jlouwers$ ssh -X root@192.168.1.20
root@192.168.1.20's password:
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
Warning: No xauth data; using fake authentication data for X11 forwarding.
Last login: Wed Jul 20 15:10:28 2011 from 192.168.1.106
/usr/bin/xauth: creating new authority file /root/.Xauthority
[root@OEM ~]#

You will see some error messages and a message stating the a new authority file is created. So the next time we login the message will look a little different;

johan-louwerss-macbook-pro:~ jlouwers$ ssh -X root@192.168.1.20
root@192.168.1.20's password:
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
Warning: No xauth data; using fake authentication data for X11 forwarding.
Last login: Wed Jul 20 20:10:54 2011 from 192.168.1.106
[root@OEM ~]#

Some of the warnings are still their however for the functionality you can ignore them. You can work on them to resolve it however I will not be covering this in this blogpost. If you now execute the command clock or xlogo you will see a the X application starting at your local machine while it is running on the machine you just connected to.

This forwarding is used for X applications running on some server which is not having a terminal or to which you have no direct access and for example need to do a installation. Downside of using this is is that if your connection brakes your application gets killed which can be an issue when you do a installation so in those cases you might want to look into other options to forward the screen to your local machine.

No comments: