Shell Stuff

This page contains a few shell trick I pick up here and there

*Open a graphical program on a remote machine through ssh tunnel:*

ssh -l “user” “remotehost” ‘export DISPLAY=:0; /path/to/program;’

*Forward an X11 session over SSH:*

local$ ssh -X user@remotehost
remote$ Xnest :1 -geometry 1024×786 -query localhost

*Use an X11 session on the non-publicly accessible host over SSH:*

  • You have to have a shell access on a publicly accessible host that has access to the machine on internal network (typically firewall or gateway for that local network)
  • What you are basically doing is enabling X11 forwarding over multiple machines using multiple SSH tunnels

**If anyone knows how to do it in another way, please let me know

local$ ssh -X -L local_port:destination_host:ssh_port user@gateway
local$ ssh -X user_on_destination_host@localhost -p local_port
remote$ Xnest :1 -geometry 1024×786 -query localhost

**Underscored words should be changed with an actual value