<rdf:RDF
    xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
    xmlns:s='http://snipsnap.org/rdf/snip-schema#'
    xml:base='http://bliki.rimuhosting.com/rdf'>
    <s:Snip rdf:about='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/misc/accessing+a+vnc+server+behind+a+firewall'
         s:cUser='retep'
         s:oUser=''
         s:mUser='retep'>
        <s:name>knowledgebase/linux/misc/accessing a vnc server behind a firewall</s:name>
        <s:content>Ever need to remotely connect to someone&apos;s desktop?  e.g. to provide remote assistance&#xD;&#xA;&#xD;&#xA;Having a problem doing that because their PC has a private (local) IP address?  Or because they are behind a firewall preventing you connecting to them?&#xD;&#xA;&#xD;&#xA;There is an option where the VNC server can connect to a VNC viewer.  But if your viewer is on a private (local) IP or you are behind a firewall then you still have the same problem.&#xD;&#xA;&#xD;&#xA;A solution to this problem is available if you (the vncviewer) has access to a server on a public IP running SSH.&#xD;&#xA;&#xD;&#xA;Assume the setup is:&#xD;&#xA;\[yourpc / vnc viewer\] &lt;---&gt; \[firewall/router\] &lt;---&gt; \[ssh sever\] &lt;---&gt; \[firewall/router\] &lt;---&gt; \[remote pc/vnc server\]&#xD;&#xA;&#xD;&#xA;On the ssh server make sure there is a &quot;GatewayPorts yes&quot; line in /etc/ssh/sshd_config&#xD;&#xA;&#xD;&#xA;Restart sshd if you had to add that.&#xD;&#xA;&#xD;&#xA;From your pc run: vncviewer -listen&#xD;&#xA;&#xD;&#xA;It will respond with something like:&#xD;&#xA;vncviewer -listen: Listening on port 5500 (flash port 5400)&#xD;&#xA;&#xD;&#xA;From your PC run:&#xD;&#xA;ssh -R port:host:hostport sshserverip&#xD;&#xA;&#xD;&#xA;e.g.&#xD;&#xA;&#xD;&#xA;ssh -R sshserverip:5500:localhost:5500 sshserverip&#xD;&#xA;&#xD;&#xA;This will setup a reverse tunnel.  The tunnel will listen on the remote ssh server on &apos;hostport&apos; (5500) for new connections.  When it gets one, your pc will be forwarded the conection and it will connect to &apos;host&apos; (localhost) on the &apos;host&apos; (localhost) port &apos;port&apos; (5500).&#xD;&#xA;&#xD;&#xA;From the remote PC the person running winvnc should &apos;Add New Client&apos; and use the sshsererip:5500 for the new client address.&#xD;&#xA;</s:content>
        <s:mTime>2005-09-07 19:29:57.0</s:mTime>
        <s:cTime>2005-09-07 19:29:57.0</s:cTime>
        <s:comments
             rdf:type='http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag'/>
        <s:snipLinks>
            <rdf:Bag>
                <rdf:li rdf:resource='#snipsnap-search'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux'/>
                <rdf:li rdf:resource='#knowledgebase'/>
                <rdf:li rdf:resource='#snipsnap-index'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/misc/quick and dirty memory checker'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/xen'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/misc/ajax autocomplete'/>
            </rdf:Bag>
        </s:snipLinks>
        <s:attachments
             rdf:type='http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag'/>
    </s:Snip>
</rdf:RDF>
