Skip to content

Instantly share code, notes, and snippets.

@am0c
Created June 8, 2012 04:13
Show Gist options
  • Select an option

  • Save am0c/2893528 to your computer and use it in GitHub Desktop.

Select an option

Save am0c/2893528 to your computer and use it in GitHub Desktop.

Revisions

  1. am0c revised this gist Jun 8, 2012. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,11 @@
    # 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)'
  2. am0c created this gist Jun 8, 2012.
    19 changes: 19 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    # VNC 서버 머신에 vnc-tunnel.sh과 vnc-setup.sh 파일을 넣고 vnc-setup.sh을 실행한다.
    # 클라이언트에서 vnc-viewer.sh을 실행한다.

    #------------ 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 vnc@vnc.gateway.am0c.org'
    vncserver :4 > /dev/null 2>&1
    pgrep -f -x "$CMD" > /dev/null 2>&1 || $CMD

    #------------ vnc-viewer.sh ------------#
    #!/bin/sh
    vncviewer -via vnc@vnc.gateway.am0c.org localhost:4