Wednesday, June 3, 2015

How to run GUI app from SSH connection


In this article i will show some cool stuff that you can do with ssh, i will show you how to run graphical (GUI) application/software remotely through ssh connection.

As we all know, ssh is basically text mode (console), so normally you run console based application while you're on ssh.

So is it possible to run GUI application on the remote server through ssh? the answer is yes, you can run GUI app through ssh.

Once you are connected to ssh server, you can go ahead type this special command.

export DISPLAY=:0

That command will granted us to execute graphical/GUI application remotely from ssh client, for example you want to open firefox web browser on the server, then type this:

firefox
You can also do this (open firefox with spesific web page)

firefox lubuntuhowto.blogspot.com

You can run any GUI application, as long as you know the name of the program. For example you want to open word app, abiword, simply type:

abiword

To prove that this is working, i demonstrate using laptop with lubuntu 14.04 and an android phone that runs jelly bean (any version of android will do just fine).

My laptop is running the ssh server, and my android phone have ssh client app called "ConnectBot" (basically you can use any ssh client app on android, there are plenty on play store).

My laptop and my android phone is connected through wifi, so both device are on the same network and can ping each other.

I need to know ip address of the ssh server, in this case is my laptop, once i know the ip address i can connect from my phone using login that i use to enter lubuntu on my laptop.

Screenshot from my android phone
As you can see from the screenshot above, i run the export DISPLAY=:0 command and then execute firefox google.com, because of this firefox on my laptop is pop-up and open google.com web page.

Have fun !!!

No comments:

Post a Comment