Kamis, 17 Januari 2019

Run the remote linux graphics application locally


Overview

The X Window System (also known as X11, or just X) is a software package and network protocol that lets you interact locally,
using your personal computer's display, mouse, and keyboard, with the graphical user interface (GUI) of an application running on a remote networked computer.

Requirements

For X forwarding in SSH to work your personal computer must be running an X server program.
The X server program manages the interaction between the remote application (the X client) and your computer's graphics hardware and input devices.

Most Linux distributions have the X server installed,
but if your personal computer is running Windows, you will most likely need to install and run an X server application, for example:

  • Xming, download and install Xming. For X forwarding to work, you'll need to start Xming before connecting to the remote system with your SSH client (for example, PuTTY).

  • MobaXTerm, download and install MobaXTerm

but now we will only focus Xming

Additionally, your personal computer's SSH terminal application must have X11 forwarding enabled:

  • In Linux, the SSH terminal supports X forwarding by default.

  • if not you can edit the sshd_config file

vi /etc/ssh/sshd_config

change for the lines below:

X11Forwarding yes
X11UseLocalhost yes

Restart the ssh srever, if you have made changes:

service sshd restart

  • In PuTTY for Windows, you can enable X forwarding new or saved SSH sessions by selecting Enable X11 forwarding in the "PuTTY Configuration" window ( Connection  > SSH > X11).
Also, the remote computer's SSH application must be configured to accept X server connections.


Use SSH with X forwarding

Linux

To use SSH with X forwarding from your Linux personal computer to run an X client application installed on remote server:

  1. Open the SSH terminal client.

  2. On the command line, enter (replacing username with your username):

  3. ssh -Y username@host

    note
    The -Y option turns on trusted X forwarding. You should use it only when connecting to secure systems.

  4. Log in with your password

  5. To test if X forwarding is working, try running xclock; on the command line, enter:

    xclock

    If X forwarding is working, the xclock graphical clock will appear on your personal computer's desktop.

PuTTY for Windows

To use SSH with X forwarding in PuTTY for Windows:

  1. Launch your X server application (for example, Xming).

  2. Make sure your connection settings for the remote system have Enable X11 forwarding selected; in the "PuTTY Configuration" window, see Connection > SSH > X11

     

  3. Open an SSH session to the desired remote system:

  4. Log in normally with your username and password.

To test if X forwarding is working, try running xclock; on the command line, enter:

If X forwarding is working, the xclock graphical clock will appear on your personal computer's desktop.

 How to start X application from SSH [simple way]
 
A short command

ssh -X username@host xapplication

note
The -X  is Enable X11 Forwarding.

Tidak ada komentar: