-
Notifications
You must be signed in to change notification settings - Fork 88
X Window forwarding
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.
You can use X forwarding in an SSH session on your personal computer to securely run graphical applications (X clients) installed on remote systems
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 hardware.
Most Linux distributions have the X server installed, but if your personal computer is running Windows or macOS, you will most likely need to install and run an X server application. If OpenSSH not installed on your system, use below command to install
sudo apt install openssh-server
- Download and install Xming.
- For X forwarding to work, you'll need to start
Xmingbefore connecting to the remote system with your SSH client - Use PuTTY terminal
- In PuTTY, you can enable X forwarding in new or saved SSH sessions by selecting Enable X11 forwarding in the
PuTTY Configurationwindow (Connection > SSH > X11).
- For X forwarding to work, you'll need to start
- Download and install XQuartz
- For X forwarding to work, you'll need to start
XQuartzbefore making an SSH connection to the remote system - Once XQuartz launches, you can use X forwarding with SSH from the Terminal or from the
xtermapplication inXQuartz - You may need to edit your
ssh_configfile, found at/etc/ssh/ssh_configor~/.ssh/config - If
ssh_configincludes#X11Forwarding no/X11Forwarding no, remove the leading#, and/or change toX11Forwarding yes
- For X forwarding to work, you'll need to start
NOTE: The remote computer's SSH application must be configured to accept X server connections.
- Use
SSHwithX forwardingon your Linux or macOS personal computer to run an X client application installed on a remote system
ssh -X {USER_NAME}@{REMOTE_SERVER_ADDRESS} -p {22/PORT_NUMBER}
- Verify connection using
xclock- If X forwarding is working, the
xclockgraphical clock will appear on your personal computer's desktop
- If X forwarding is working, the
xclock
-
To use SSH with X forwarding in PuTTY for Windows:
- Launch your X server application (for example, Xming)
-
Make sure your connection settings for the remote system have Enable X11 forwarding selected; in the "PuTTY Configuration" window
- see
Connection > SSH > X11
- see
-
Verify connection using
xclock- If X forwarding is working, the
xclockgraphical clock will appear on your personal computer's desktop
- If X forwarding is working, the
xclock
-
Step 1 - Launch Docker on a remote server -
ssh-port-forward-enabledin the Terminal 1
sudo docker run -it --device=/dev/kfd --device=/dev/dri --cap-add=SYS_RAWIO --device=/dev/mem --group-add video --network host --env DISPLAY=unix$DISPLAY --privileged --volume $XAUTH:/root/.Xauthority --volume /tmp/.X11-unix/:/tmp/.X11-unix kiritigowda/ubuntu-18.04:ssh-port-forward-enabled
- Step 2 - Start ssh service in Terminal 1 within the launched Docker
sudo service ssh start
-
Step 3 - Connect to the remote server with Terminal 2 with
-Xoption -
Step 4 - Login to the Docker launched on the remote server on Terminal 2
ssh -X root@localhost -p 23
NOTE: password - root
- Step 5 - Test X-11 port forwarding
export PATH=$PATH:/opt/rocm/mivisionx/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rocm/mivisionx/lib
runvx /opt/rocm/mivisionx/samples/gdf/canny.gdf
- Step 6 - Check for ROCm version
dpkg -l | grep rocm
Copyright (c) 2015 - 2023 Advanced Micro Devices, Inc. All rights reserved.