Deru Knowledgebase
Search:     Advanced search
Browse by category:
Contact Us

SSH Port Forwarding (SSH tunneling ) in Linux machines.

Add comment
Views: 2741
Votes: 0
Comments: 0
Posted: 01 Mar, 2008
by:
Updated: 17 Jul, 2012
by:
SSH Port Forwarding allows us to communicate with any remote server in secured way.
Here a port in a local machine will be configured to forward requests to  a destination  web or  mail servers through SSH tunnel established with any other server.

The command used to accomplish this scenario is  given below.

ssh -L localport:host:hostport user@ssh_server -N 

where:
-L - port forwarding parameters

localport - local port (chose a port that is not in use by other service)

host - server that has the port (hostport) that you want to forward

hostport - remote port

-N - do not execute a remote command,

user - user that have ssh access to the ssh server (computer)

ssh_server - the ssh server that will be used for forwarding/tunneling

Without the -N option you will have not only the forwarding port but also the remote
shell. Try with and without it to see the difference.

We can have multiple  '-L' parameters used for  multiple port forwarding for  different services like, HTTP, SMTP, POP.

See some examples. :)

ssh -L 8888:www.myhost.com:80 user@ssh_host -N 

ssh -L 8888:www.myhost.com:80 -L 110:mail.myhost.com:110 \
25:mail.myhost.com:25 user@ssh_host -N




Others in this Category
document Unix and windows text file formats
document How to find uptime of a windows/Linux server ?
document Delete files/folder having special characters in their name
document rpmdb: Lock table is out of available locker entries ?
document Set up an SSH tunnel for webmail access using putty.
document Use "find" comand to find files by time stamp
document Album access issue in Gallery
document How to install APC (Alternative PHP Cache)
document Steps to clear Browser cache
document How to clear DNS Cache
document How to change the hostname of a Linux system
document Upgrade from PHP4 to PHP5: Backward Incompatible Changes
document How to reset mysql root password in the server?
document Website creation and site management via Webmin/Virtualmin
document Contact Email Address for your website
document Using traceroute command
document How to migrate a mysql user to another server?
document How to create virtual server Alias in Virtualmin?
document How can we create sub domains via Virtualmin?
document How to configure email filters via cPanel?
document How ot redirect URLs via cPanel?
document How to deny an IP address via cPanel?
document How to change MySql database password via cpanel?
document How to change MySQL User Password?
document How to enable remote Mysql access from cPanel?
document Linux commands to check the hardware details.



RSS