chrisspeck.com

Chris' random ramblings

Remotely starting X11 apps on other displays

user@laptop:~$ ssh -X user@desktop
...
user@desktop:~$ printenv
...
DISPLAY=localhost:10.0
...
_=/usr/bin/printenv
user@desktop:~$

Take note of the “DISPLAY” variable, this is the local port (on the machine called “desktop”) which is forwarding X11 server commands to the X11 client running on the machine called “laptop”.

user@desktop:~$ export DISPLAY=:0.0
user@desktop:~$ vlc &

This sets the “DISPLAY” variable to the first screen on the desktop, and starts VLC as a background process. For this to work you must be logged into the server with the same user account, and have an X11 client running on the desktop.

user@server:~$ export DISPLAY=localhost:10.0
user@server:~$ gedit &

This sets the “DISPLAY” variable to the laptop, and starts Gedit on the server, but displaying it on the laptop.

posted by specky in IT and have No Comments

Using SSH in Bash to tunnel IP traffic

While it is trivial to set up locally forward ports using a GUI SSH client like Putty, I have a habit of forgetting how to do the same at the Bash command line, and I find the ssh man page a tad confusing. Cutting straight to the chase:-

$ ssh -X myserver.dyndns.org -p 1045 -L 10001:192.168.0.100:10000

This will connect to server called “myserver.dyndns.org” on arbitrary external port 1045, and map your localhost port 10001 to port 10000 on the machine with IP address 192.168.0.100 on the remote site (allowing you, for instance to access Webmin on the remote machine by going to https://localhost:10001 ).

The tack “-X” tells SSH to forward X11 requests, allowing you to run GUI applications on the remote machine and have the display on your local machine without further configuration in a Linux environment, or after installing a program like Cygwin on a Windows machine.

posted by specky in Uncategorized and have No Comments