How to open the display from ssh login?

You can use the -X option to forward graphical applications. People typically forward single applications or the taskbar or panel rather then the entire desktop. For applications such as Firefox people typically "tunnel".

ssh -X user@server

Then you can

startkde &

To use Xephyr :

sudo apt-get install xserver-xephyr

Start a Xephyr session

# change "1280x1024" to the size you desire
Xephyr -ac -screen 1280x1024 -br -reset -terminate 2> /dev/null :1 &

Set your $DISPLAY (assuming Xephyr is on :1)

DISPLAY=:1.0

ssh in to your server and start kde

ssh -XfC -c blowfish user@server startkde
  • -X = forward X
  • -f = puts your ssh session into the background
  • -C = use compression -c blowfish = use blowfish (I am told this is the fastest)

If you are using ssh, be sure to understand the security risk, and I personally advise you use keys and disable password authentication.

If you want an entire desktop I would suggest FreeNX. FreeNX is both fast and secure.

https://help.ubuntu.com/community/FreeNX


If you're just talking about running a graphical application from the terminal, you can specify the DISPLAY environment value like so:

DISPLAY=:0 gcalctool

Or if you want it to persist you can export it to remain part of your bash session:

export DISPLAY=:0