So X11 Forwarding!
Hey there! How’s it going? Today we are going to focus on how to run an application that requires a graphic interface on your Ubuntu server where typically Ubuntu server does not come with GUI. Let’s map your Desktop GUI to the remote server by using X forwarding, It is easy to accomplish X forwarding on Ubuntu using X11 & SSH.
Plus I have already written on Remote login with GUI in Linux – VNC. Read it if you haven’t. It’s another way of getting done same task.
Below is an image of SSH concept.
So X11 is a
X11 is a network protocol designed for Unix and similar operating systems to enable remote graphical access to applications. The original X windowing system was announced in 1984 and developed at MIT. A machine running an X windowing system can launch a program on a remote computer. All the CPU processing happens on the remote computer but the display of the application appears on the local machine. – toastytech.com
Configurations – X11
X11 forwarding needs to be enabled on both the client side and the server side.
On the client side, set X11 Forwarding yes must specified in ~/.ssh/config.
On the server side, set X11 Forwarding yes must specified in /etc/ssh/sshd_config.
Next on your server, make sure you have xauth installed.
dasunhegoda@dasun:~$ which xauth /usr/bin/xauth
If not install xauth using below command.
sudo apt-get install xauth
Configurations are done. piece of cake right? Let’s login in now.
ssh -X -v email@example.com
If you are trying -X for the 1st time you will see the below O/P.
/usr/bin/xauth: creating new authority file /home/user/.Xauthority
Let’s test now. The following commands will install Mozilla’s Firefox web browser.
sudo apt-get install firefox
Launch Mozilla’s Firefox web browser.
What above command will do is, it will use your client GUI and fire up the firefox on the server. Beauty of X11 forwarding.
That’s it. Hope you got an idea how to do X11 forwarding. If you have any questions let me know in the comments below. Your feedback is highly appreciated(happy-face).