How to get Remote Linux applications on your Mac or Linux Desktop with X-forwarding.

Dec 11

The great thing about being a cross platform geek is that you don’t need to decide what operating system you use. You can just pick and choose what OS suits your fancy. But if you use the combination of Linux and OSX you can have your cake AND eat it with the wonderful technology called X-Forwarding.

What is it ? : X-forwarding is the art of opening a single application window over and SSH connection. Instead of taking over the desktop of your remote Linux machine with something like VNC or Teamviewer, you can just choose to open a single application on a remote system.

How does it work ? : To open a Linux application on an OSX desktop you need to enable the SSH server on the Linux machine first. If you are using something like Ubuntu or Linux Mint you can just type “Sudo apt-get install openssh-server”  Next up you need to teach your SSH server to allow X-Forwarding. This means, sending screen information across that SSH tunnel. 

To do this edit your  /etc/ssh/ssh_config file and uncomment the line that says “ForwardX11 nl”  and change it to “forwardX11 yes”  Reboot your linux machine and you will be set.

Opening an application. What you need to do on your “other” system  is “Tunnel in” to the machine we configured X11 forwarding on. You need to use an SSH connection with this parameter   :   ssh -X yourusername@ipofyourserver   The -X makes sure that you can open graphical applications.

Once the connection is established , just choose the name of an application and end with an “&”  : For example “firefox&”

Where does it work.

Linux to Linux is not a problem. Xforwarding is a cool way to open up an application on a remote system using the CPU power of that remote system. 

Linux to Mac : Apple decided to remove the funtionality of X11 Forwarding in Mountain Lion : To fix this, download and install X11Quartz to your Lion or Mountain Lion machine an you will be good to go. You cannot turn your Mac into an X11 Server , but you CAN use it as an X11 client , so that way you can open Linux apps on your mac. Download the app HERE

Linux to Windows : You can even do it in Windows ! Download and install Xming to make your Windows machine play nice with X11 forwarding.

So, time to get cracking and tell us : On what Server and Client system are you using X-forwarding and what do you do with it ?  


Related Posts