Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Connect to an x11vnc server over an SSH tunnel from a Mac
#!/bin/sh
# Tip: An executable script given a `.command` suffix will be double-clickable on Mac OS X
REMOTE_SSH_USER=pi
REMOTE_SSH_HOST=192.168.0.17
REMOTE_VNC_SERVER_PORT=5900
LOCAL_VNC_PORT=5901
# This is the RealVNC Viewer, works with Chicken of the VNC too
LOCAL_VNC_CLIENT=/Applications/VNC\ Viewer.app/Contents/MacOS/vncviewer
ssh -f -L 127.0.0.1:$LOCAL_VNC_PORT:localhost:$REMOTE_VNC_SERVER_PORT $REMOTE_SSH_USER@$REMOTE_SSH_HOST x11vnc -safer -localhost -rfbport $REMOTE_VNC_SERVER_PORT -nopw -once -display :0 -timeout 60 -no6 -noipv6 && sleep 3 && $LOCAL_VNC_CLIENT 127.0.0.1:$LOCAL_VNC_PORT
@Klaswh

This comment has been minimized.

Copy link

@Klaswh Klaswh commented Aug 21, 2017

You need to put LOCAL_VNC_CLIENT between quotes. So the line should bee:

ssh -f -L 127.0.0.1:$LOCAL_VNC_PORT:localhost:$REMOTE_VNC_SERVER_PORT $REMOTE_SSH_USER@$REMOTE_SSH_HOST x11vnc -safer -localhost -rfbport $REMOTE_VNC_SERVER_PORT -nopw -once -display :0 -timeout 60 -no6 -noipv6 && sleep 3 && "$LOCAL_VNC_CLIENT" 127.0.0.1:$LOCAL_VNC_PORT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.