OpenSSH: Graphical Window Forwarding
Introduction
OpenSSH is capable of exporting X windows from another machine (creating an SSH tunnel). For example, you can connect to a server that has X and you only have SSH access to the remote machine.
In your SSH configuration file (/etc/ssh/sshd_config
), set this to yes:
|
|
Launching the Session
Here’s an example session. Here we’ll export VNC which is running on the direct machine:
|
|
This will export the remote port 5901 to the local machine’s port 5901.
If we need to go through an SSH gateway first:
|
|
It’s also possible to automate an SSH tunnel by adding a line like this in the SSH configuration file (~/.ssh/config
):
|
|
Here’s an example:
|
|
Connecting to the Remote Session
Launch vncviewer and connect to “localhost:1”. You will then see the remote server screen.
Conclusion
SSH is capable of forwarding any window and any port. For security reasons, it’s preferable to open as few ports as possible. Just open SSH to pass these types of services.
Resources
Last updated 12 Jan 2009, 09:37 +0200.