3 ms·
One common use is to secure vnc, which has no crypto built into it. On the remote host, have the vnc server listen only on localhost:5901 This assumes everyon
by walrus01 6y ago
One common use is to secure vnc, which has no crypto built into it.
On the remote host, have the vnc server listen only on localhost:5901
This assumes everyone who can ssh to the server should be allowed access.
On your workstation, form an ssh tunnel to that remote host and its port, and link it your own localhost:5901
Open your vnc client GUI and set it to open 127.0.0.1:5901, voila, vnc session.
More fun things: say for example you have a big remote xen dom0 with a lot of unique qemu HVM VMs running on it. Configure each of their .cfg files for xen to spawn a vnc server on localhost only and a unique port number per domU (5902,5903,5904,etc). Then use the same method to connect.
- chrisandchris 6y agoI am always amazed at what is possible with the linux command line, and it‘s something one can really fall in love with.
- labawi 6y agoNote that it still exposes the connection to all local processes, on both hosts (except network-restricted services or with non-typical host-local firewall rules), though it should be fine, if you're using semi-reasonable passwords. SSH supports unix domain socket forwarding and even cross unix/ip forwarding with a syntax like: ssh -L /path/to/sock:/path/to/sock ssh -L /path/to/sock:localhost:5901 ssh -L 5091:/path/to/sock Then you can have user-authenticated host and transit secure password-less VNC connections. Unfortunately I haven't been able to convince tigervnc viewer to connect to a unix domain socket, so I don't have a fully scripted connection, but remmina and tigervnc server work fine. Also, forwardings / connections fail if the socket already exists when the listening side starts up (often an unclosed leftover), so I rm them before starting the ssh connection / vnc server and it works reliably.
- philsnow 6y agoWow that's amazing, I've been cobbling together socat processes because I didn't know this was possible.
- m463 6y agoI do this for a number of hosts simultaneously with macos and map them specifically in my .ssh/config: Host mac-a ... LocalForward 5903 localhost:5900 Host mac-b ... LocalForward 5904 localhost:5900 then I open the directory /System/Library/CoreServices in the Finder and drag Screen Sharing.app to the dock. to remote into machine mac-b, in a terminal window: ssh mac-b The first time, click on "screen sharing" in the dock, and in the connect dialog enter localhost:5904 After that, you can right-click on screen-sharing in the dock - even when it's not running - and you will see a context menu item for "mac-b 5904.vncloc" By the way, mac to mac screen sharing is very well done (will they axe it next?) - it is very fast - the keyboard stuff just works - you can copy/paste even rich text between the local and remote macs - you can drag and drop files from the remote desktop to the local one