Peter's Blog

Redefining the Impossible

Using ssh to connect to a proxy server or vnc server via ssh tunnelling


This is the ssh command line to connect to a squid proxy server via ssh:

ssh -L 3128:127.0.0.1:3128 user@remoteaddress

using cygwin open-ssh.

What is this doing? Well ssh starts running on the local pc and creates a socket on port 3128 (this is given by the first 3128 on the command line). Firefox is then configured to use localhost:3128 as the http proxy. ssh then takes connections to that port and forwards them to the ssh server running remotely. It will go through any firewalls in between provided that port 22 (the ssh port) is open. It encrypts whatever is going through it. The ssh server connects to port 3128 on the remote pc which is the squid server port. The squid server acts as a nice caching proxy server and fetches whatever web pages you are looking for.

This works with Ubuntu after installing the standard open-ssh package and the squid proxy.

It must work or you wouldn't be reading this.

Even more cool: using VNC over SSH. This allows gives you a remote desk top cool

  • install tightvnc package on remote server
  • on local pc run the command:
    ssh -L 5900:127.0.0.1:5901 user@remoteaddress
    
  • on server, run the command
    vncserver :1
    
    The first time you do this you will be asked for the login password.
  • On local pc, run a vnc viewer such as ultravnc. Connect to 127.0.0.1:0 and enter the password

This gives you remote access to the server desktop. Easy really and better, in my humble opinion, that using remote X, especially with a local PC running cygwin as X on that is a bit buggy.

Note: for me, vncserver :1 worked as X was already running on the box. The 5901 in the ssh command caters for display 1 being on a port number 1 higher than the default of 5900.


Filed under: cygwin firefox squid ssh ubuntu vnc

1 Comment

Peter Says:

over 5 years ago
vncserver :1 -geometry 1024x768

gives a more useful screen size on the virtual desktop.

Peter

Sorry but comments on this post are now closed.