Friday, August 11, 2023

How to Show Remote Ubuntu Desktop screen from Windows computer

Terminology

  • X server: it runs on Windows, wait connection from Ubuntu and provides display, mouse, keyboard to X client that connected onto windows computer. Cygwin/X is used.
  • X client: it runs on Ubuntu and connect to Windows and show GUI onto X Server on Windows. gnome-session, gnome-terminal,  firefox, xclock, xeyes, ...
  • SSH server: it runs on Ubuntu and wait connection from Windows computer. openssh-server is used.
  • SSH client: it runs on Windows and connect to SSH server. Teraterm is used.

There are two physical computers, Windows computer and Ubuntu computer. I'm going to do the following things: On Windows, start Cygwin/X to wait to accept remote X client connection, then run Teraterm  to connect Ubuntu and run some X client on Ubuntu to connect to Cygwin/X of Windows to show Ubuntu GUI on Windows computer screen.

Setup ssh on Ubuntu computer

On Ubuntu computer, apt install ssh to install/enable sshd. 

sudo apt install openssh-server

 

And allow ssh connection to firewall by

sudo ufw allow ssh
 

Determine your Ubuntu computer IP address

 

Check ip address of your Ubuntu computer. On Ubuntu computer, open Terminal and type

ifconfig

 

In my case, it is 192.168.11.103


Connect Ubuntu from Windows computer using Tera term via SSH

 

On Windows computer, visit 

    https://teratermproject.github.io/index-en.html

 and download Teraterm installer.


On installation, make sure to choose to install "Teraeterm Menu" feature and set it runs on Windows startup. 

 

After install, right click Teraterm Menu icon on system tray and add your Ubuntu computer IP address, username, password and enable ssh. 

 

Left click Teraterm menu icon on the system tray, choose your Ubuntu connection profile to connect to Ubuntu.


Determine your Windows computer IP address

 

On Windows, run cmd and type 

ipconfig

 

It shows IP address of your computer. My Windows computer IP is 192.168.11.199


Install Cygwin/X on Windows

 

Install Cygwin/X onto Windows computer https://x.cygwin.com/

 

My Cygwin installation directory is C:\cygwin64

On Cygwin installation, check xterm and xhost from package selection


Open C:\cygwin64\bin\startxwin with your text editor (I use Sakura editor) and modify

serverargs="" with

serverargs="+iglx -wgl -listen tcp"


On windows start menu, choose Cygwin-X → Xwin server to run Cygwin X server.


Disable X server authentication of Windows Cygwin/X server to allow connection from Ubuntu



On Windows, left click Cygwin/X icon on system tray, choose System tools → XTerm to run xterm
On XTerm window, type
 
xhost +


Connect Ubuntu from Windows computer using Teraterm via SSH

On Windows, left click Teraterm menu and connect to Ubuntu computer.

Type the following commands on Teraterm command prompt to run gnome desktop session onto your Cygwin/X X server.

export DISPLAY="192.168.11.199:0"

export WAYLAND_DISPLAY="192.168.11.199:0"

export XDG_SESSION_TYPE=x11

gnome-session


Where 192.168.11.199 is IP address of my Windows, that is determined by ipconfig on the earlier step. 

 Ubuntu desktop is shown on your Windows computer. Remote Ubuntu computer can be used as a local native Ubuntu computer from Windows


If it is not necessary to run whole Ubuntu desktop on your Windows desktop, just run gnome-terminal or xterm instead of gnome-session


MobaXterm


There is relatively new X server program called MobaXterm. I don't tested it but maybe it is easier to use



No comments:

Post a Comment