Question

I have a Raspberry pi that I have been accessing through SSH, but now I need to run a python program on it that has a GUI. I'm not sure how to do this through SSH. Usually I get to my raspi's desktop gui by typing startx. Is there anything I can do like this over ssh?

Thanks!

Was it helpful?

Solution 2

You can do X11 forwarding with ssh. If you start an ssh session with -Y or -X it'll enable X11 forwarding. So, any program you run in that session that creates a window, the window will be drawn locally. You can also pass ssh a command to run :

$ ssh -Y user@$some_ip /path/to/some/remote/python_script.py

If you want a full gui session, then you'll want to setup an RDP or VNC server on the rasp pi and connect to it with some client.

OTHER TIPS

The approach mentioned by kjprice just displays the applications you started on the remote host. If you want to see a complete dektop, you could either create a new Xserver or use Xephyr to nest a Xserver in the one you are currently using.

Well first create a new nested Xserver:

user@host $ Xephyr :1 -screen 800x600 &

A window called "Xephyr on :1" should spawn. Ssh into the remote host an forward the display to the created display:

user@host $ DISPLAY=:1 ssh -Y username@remotehost

Now start a session on the remotehost, in my case LXDE:

user@remotehost $ lxsession

You should now see the desktop in Xephyr. hf

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top