[CentOS] openssh port forward in centos 4

Les Mikesell lesmikesell at gmail.com
Sun Nov 6 19:09:40 UTC 2005

On Sun, 2005-11-06 at 12:41, Johnny Hughes wrote:
> On Sun, 2005-11-06 at 13:06 -0500, Erick Perez wrote:
> > Hi, I use putty in my windows xp machine. ssh server in a centos 4.
> > The centos 4 machine runs a web server that listens on port 1812, the
> > centos machine is behind a firewall that allows tcp 22 connections
> > only. I am on public internet.
> > 
> > Can I forward/redirect/allow my web browser in windows to "see" the
> > web page in port 1812 of the centos machine via the SSH connection?
> > 
> I don't think you can use port 22 for ssh ... AND ... also forward it to
> port 1812.

Putty or ssh can portforward local ports through the ssh connection
to anything on the other side of the connection.  If you:
ssh -L1812:localhost1812 your_ssh_server
then point your browser at localhost:1812 the connection will
actually go to the remote system's idea of localhost.  Note that
all the links on a web site have to be written as relative
references for this to work beyond the first page (as they
should anyway...). With putty you would set this up in the 
'tunnel' dialog. The port numbers are arbitrary - there is
no reason other than your sanity to make them the same at
both ends.  The remote address can also be some other machine
that the remote side can reach, and you have the option of
exposing the local port to other machines if you want (the
default is local access only).

If you are a system administrator and don't understand this,
your internal services may be a lot less secure than you
think.  If you allow ssh logins you basically allow remote
pass-through to other systems for anything the user could
reach himself when logged in.  

   Les Mikesell
     lesmikesell at gmail.com

More information about the CentOS mailing list