[Discuss] S/W in Linux to change its default ports

Scott Petersen scott at slal.net
Mon Jan 8 10:21:01 PST 2007


J.Bakshi wrote:
> Hi all,
>
> I wounder if there is any S/W in Linux to change its default ports.
> Like SSH is using port-22 and http using port-80. Now if I want to run SSH on 
> say port 2890 and http on port 1240; how to do that ? any GUI to change these 
> default ports ?
>
> thanks
There really isn't a single interface that will change all the ports for 
different software. Each application will have its own configuration 
that can be modified to change the ports that it uses.

Apache's config file is called htpd.conf and there is a parameter called 
"Listen" that determines the Interface and Port that Apache will listen on.

e.g. Listen 0.0.0.0:1240 

This will cause apache to listen on port 1240 on all interfaces. 
(Easiest thing to do if you have a single network interface and a 
dynamic IP address.)

As well the SSH Daemon has a config file named "sshd_config" that has a 
parameter called Port

e.g. Port 2890

All this being said, if you really want a single tool to change all 
ports on a system you could use iptables to mostly accomplish that. 
Iptables can do port forwarding (DNAT or Destination Network Address 
Translation). With  that tool you could block external access on port 22 
and forward external connections to port 2890 to port 22. The SSH Daemon 
would still be listening on port 22. This is much more complex than just 
using each application's config and, in my opinion, is really the wrong 
way to accomplish things.

On another note, I think you should check the date on your system. The 
Date header on your email was set to November of last year.

Cheers
Scott Petersen


More information about the Discuss mailing list