Skip to content

Instantly share code, notes, and snippets.

@am0c
Created June 8, 2012 04:13
Show Gist options
  • Save am0c/2893528 to your computer and use it in GitHub Desktop.
Save am0c/2893528 to your computer and use it in GitHub Desktop.
VNC 터널링
# VNC 서버 머신에 vnc-tunnel.sh과 vnc-setup.sh 파일을 넣고 vnc-setup.sh을 실행한다.
# 클라이언트에서 vnc-viewer.sh을 실행한다.
#
# +----------+ ssh +-----------+ ssh +----------+
# | Server |---->| Gateway |<----| Client |
# +----------+ +-----------+ +----------+
# ? vnc.gateway.am0c.org ?
#
#------------ vnc-setup.sh ------------#
#!/bin/sh
echo 'You should use DSA key (ssh-keygen -t dsa; chmod 400 id_dsa)'
pgrep -f -x ssh-agent > /dev/null 2>&1 || eval `ssh-agent`
echo 'Please add vnc-tunnel.sh to your crontab (*/12 * * * * sh svn-tunnel.sh)'
crontab -e
#------------ vnc-tunnel.sh ------------#
#!/bin/sh
CMD='ssh -N -f -R 5904:localhost:5904 [email protected]'
vncserver :4 > /dev/null 2>&1
pgrep -f -x "$CMD" > /dev/null 2>&1 || $CMD
#------------ vnc-viewer.sh ------------#
#!/bin/sh
vncviewer -via [email protected] localhost:4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment