Operating System - Linux
1819832 Members
3099 Online
109607 Solutions
New Discussion юеВ

Re: How to change Default PORTS ???

 
SOLVED
Go to solution
Deep_6
Occasional Advisor

How to change Default PORTS ???

Hi,
Does any one know how to change the default ports in linux. Like SSH service uses 22 port.

Senerio: My Server is 192.168.0.1 and client is 192.168.0.2 now SSH service is ON on My server but when my client will SSH on the server it will by default use 22 port which i dont want. I want to configure some other port which my client uses to log in how can i configure that ?

What are the configurations required and is it possible for every port like http and other ports too?
Thanks in advance
Deep
5 REPLIES 5
Slawomir Gora
Honored Contributor
Solution

Re: How to change Default PORTS ???

Hi.

1. for ssh client you can modify default port by adding line to file /etc/ssh/ssh_config:
Port Number

2. for ssh server the same line but in server config file
/etc/ssh/sshd_config

When you modify sshd_config file you have to restart sshd daemon.

For details look at man pages:
man ssh_config
man sshd_config
Deep_6
Occasional Advisor

Re: How to change Default PORTS ???

Hey Thanx man it worked....!!! full points from my side
Just one question
Is this possible for all the ports like http and telent ..... etc...?
if yes we just need to change the ports and restart the services right ????
Slawomir Gora
Honored Contributor

Re: How to change Default PORTS ???

Hi,
it is not posible to change ports for all
server daemons. More easy is to set ports for
servers than clients site.
Ex.
for http apache server- you can configure port
in httpd.conf, client has default port 80 and
I don't know how to change this (it may depends
on your web browser)

For telnet server you can modify (x)inetd config file, from client site you must run
telnet command with port number.

man in.telnetd
man telnet
rick jones
Honored Contributor

Re: How to change Default PORTS ???

At the HTTP client end you would select the server's non-standard port number in the URL with the portnumber following a colon ":" after the hostname:

http::/foo.bar.baz:12345/

Of course, there is the question of "why?" Why do you want to change the port numbers?
there is no rest for the wicked yet the virtuous have no pillows
Ross Minkov
Esteemed Contributor

Re: How to change Default PORTS ???


Unless you have a specific reason to change ports it is wise to use the standard ports. You can find most of the standard ports in the /etc/services file.

The latest IANA port assignments can be gotten from http://www.iana.org/assignments/port-numbers

The port numbers are divided into three ranges: the Well Known Ports,
the Registered Ports, and the Dynamic and/or Private Ports.

The Well Known Ports are those from 0 through 1023.

The Registered Ports are those from 1024 through 49151

The Dynamic and/or Private Ports are those from 49152 through 65535

Regards,
Ross