Start GUI program on the remote machine using your local display through ssh

This article is probably not only for absolute beginners, so many Linux guys do not know they can just execute a GUI program on their remote machine but the output of the graphics to be drawn in the local display, it’s like your local display is connected to the remote computer through the network. And you do not need any special software like VNC Client/Server, TeamViewer – all you need is the OpenSSH package you probably have when managing a remote machine. And it is absolutely secure because all the communication is performed within ssh.
Suppose you have a machine, which has some GUI capabilities (you know if we speak for servers, not all servers need the GUI, but in some cases we need it) and you want to execute a graphical program on the remote.
Here is how you can login to be sure you can execute the program remotely:

ssh -o ForwardX11=yes -o ForwardAgent=yes -o ForwardX11Trusted=yes [USER]@[IP]

And you can also execute a remote command with the ssh:

ssh -o ForwardX11=yes -o ForwardAgent=yes -o ForwardX11Trusted=yes myuser@192.168.0.245 'virtualbox'

This command will execute virtualbox on your remote machine with login myuser@192.168.0.245 and the output the display on your local machine.

Here are some examples. Gentoo Desktop using KDE with konsole get to the remote machine on our local network 198.160.245:

SCREENSHOT 1) Login in your remote machine and there type firefox. The firefox will be executed on the remote machine, but the graphics will be output on your local display.

main menu
Remote execute Firefox through ssh

Keep on reading!