Page 1 of 1

Remote programming with SSH and X11 Forwarding

Posted: Mon Oct 10, 2022 12:43 pm
by mk-soft
Remote programming with SSH and X11 Forwarding

Sometimes the screen is not connected or too small to programming with Purebasic on the Raspberry
For this, the SSH server on the Raspberry must be activated.

Under Linux it is easy, because X11 is available. Under Windows and macOS, an X11 server must be installed first.

Login Linux:
Start Terminal
- $ ssh -Y pi@<IP or hostname>

Login macOS
Start Terminal
- $ ssh -X pi@<IP or hostname>

Login Window:
Start Xming Server
Start Putty
- Session:
* Hostname 'pi@raspberrypi'
- Connection -> SSH -> X11:
* Enable X11 forwarding
* X display location 'localhost:0'

After logging in to the Raspberry, you can start the X11 application via Terminal.

Example 1:
- $ geany &

Example 2:
- change path to ./purebasic/compilers
- $ ./purebasic &


Downloads Window:
Link Xming: https://sourceforge.net/projects/xming/ ... /6.9.0.31/
Link Xming fonts: https://sourceforge.net/projects/xming/ ... /7.7.0.10/
Link Putty: https://www.chiark.greenend.org.uk/~sgt ... atest.html

Downloads macOS
Link XQuartz: https://www.xquartz.org

Re: Remote programming with SSH and X11 Forwarding

Posted: Tue Oct 11, 2022 3:35 am
by idle
Thanks, that will be useful

Re: Remote programming with SSH and X11 Forwarding

Posted: Tue Oct 11, 2022 8:31 am
by Joris
@mk-soft thanks.
But...
On Raspbian VNC is pre-installed and easy to activate and use in combo the with VNC-viewer on the different OS's.
Also VNC gives you the active desktop of the Pi, so already active programs opened on the Pi can be remotely handled.
This I could not do with the setup using SSH and X11, a second desktop (new) is openend then.

Re: Remote programming with SSH and X11 Forwarding

Posted: Tue Oct 11, 2022 8:39 am
by dige
Thanks mk-soft, that helps me with my laptop and Purebasic on Debian 11. On the Raspberry, I prefer also the preinstalled VNC

Re: Remote programming with SSH and X11 Forwarding

Posted: Thu Oct 13, 2022 5:45 pm
by infratec
In general:

VNC 'hijack' a device.
XServer and Client allows to start a total different connection with different screen resolution.

Re: Remote programming with SSH and X11 Forwarding

Posted: Tue Oct 18, 2022 8:38 am
by dige
@infratec: good point!

I wanted to try this out, but I'm already failing with the ssh activation on the PI.

Which IP do I have to enter? The IP of the computer from which I want to connect the PI, right?

Re: Remote programming with SSH and X11 Forwarding

Posted: Tue Oct 18, 2022 9:51 am
by mk-soft
To connect with ssh The IP address or hostname of the raspberry.

If the SSH server on the raspberry is not yet active:
sudo raspi-config
- 3 Interface Options
- I2 SSH Enable / disenable ...

Re: Remote programming with SSH and X11 Forwarding

Posted: Tue Oct 18, 2022 10:33 am
by dige
Thanks, it works great now. It also works much better than with VNC! Thank you very much!

Re: Remote programming with SSH and X11 Forwarding

Posted: Tue Oct 18, 2022 10:38 am
by mk-soft
Of course, not all the functions of the graphics output are available as directly on the raspberry. (OpenGL, etc).
The programme runs on the Raspberry and the GUI runs on the X11 server of the local machine.
Thus, the output of the GUI also looks different, depending on which X11 server is used.

Re: Remote programming with SSH and X11 Forwarding

Posted: Wed Oct 19, 2022 9:30 am
by Joris
With SSH and X11, how do you prevent having already openend and running software on the Pi ?
As that setup creates a new desktop on which nothing is shown of running software.
What if making several new connections (after having closed the one before) and not closing active programs on the Pi ?

Ok, you can doe a reboot of the Pi, but that is not a nice way ...
As told VNC show the current active desktop, with SSH always a new clean one.

Re: Remote programming with SSH and X11 Forwarding

Posted: Wed Oct 19, 2022 11:20 am
by mk-soft
An ssh connection does not have a desktop. The started application runs the GUI output on the local computer in the X11 server. This means on the desktop of the local computer and not on the Raspberry.

Re: Remote programming with SSH and X11 Forwarding

Posted: Wed Oct 19, 2022 2:26 pm
by NicTheQuick
In the past I also had good experiences with XRDP to a normal Ubuntu VM. It can be used on Windows with the default Windows Remote Desktop application.

Of course you can also use it with a Raspberry. Here is just one of many links to that topic: https://linuxize.com/post/how-to-instal ... pberry-pi/

Usually you can change the desktop resolution and other things.