How to configure Telnet server on Custom Port

Posted: 22 Mar 2019 in SERVER
Tags: , , ,

How to configure Telnet server on Custom Port. Or you can say how to configure secure telnet server. Secure in the sense it is binded with a different port rather than telnet default port and so it become more difficult to hack or even port scanning tool or service scanning tool like nmap can’t scan it properly.

Our Telnet Server Machine is 192.168.225.38 and as we know by default Telnet works on PORT Number 23 but here in this lab we are going to run Telnet Service on a PORT 9898 which is a custom port and we have to tell the Linux Machine about this unknown Port.

Also Learn:

How to configure Telnet Server on Linux Machine.

 

Step1: Install Telnet Package.

[root@localhost ~]# yum install telnet telnet-server -y
Loaded plugins: rhnplugin, security
Repository ‘a’ is missing name in configuration, using id
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Package 1:telnet-0.17-39.el5.i386 already installed and latest version
Package 1:telnet-server-0.17-39.el5.i386 already installed and latest version
Nothing to do
[root@localhost ~]#

 

Step2: Copy /etc/xinetd.d/telnet file to /etc/xinetd.d/stelnet

[root@localhost ~]# cp /etc/xinetd.d/telnet /etc/xinetd.d/stelnet

 

Step3: Now your content inside /etc/xinetd.d/stelnet content will be like this.

service stelnet
{
disable = no
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID

port = 9898
}

Step4: Now Define the PORT 9898 through file /etc/services

go to /etc/services file and add the below line

stelnet           9898/tcp                  #secure telnet port

secure telnet

Step5: Restart the Xinetd service

[root@localhost ~]# service xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
[root@localhost ~]#

[root@localhost ~]# service xinetd status
xinetd (pid 4159) is running…
[root@localhost ~]#

 

Step 6: Disable Firewall and selinux just for Testing Process.

 

[root@localhost ~]# iptables -F
[root@localhost ~]# setenforce 0
[root@localhost ~]#

 

Step 6; Go to Telnet Client Machine and login through telnet on custom port 9898

telnet connection

Step7: Going to trace Open Port on Telnet Server using NMAP.

 

[root@localhost ~]# yum install nmap
Loaded plugins: rhnplugin, security
Repository ‘a’ is missing name in configuration, using id
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Package 2:nmap-4.11-1.1.i386 already installed and latest version
Nothing to do
[root@localhost ~]#

 

Now scanning Time:

[root@localhost ~]# nmap 192.168.225.38
Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2019-03-21 12:38 EDT
Interesting ports on 192.168.225.38:
Not shown: 1674 closed ports
PORT STATE SERVICE
22/tcp open ssh
79/tcp open finger
111/tcp open rpcbind
139/tcp open netbios-ssn
445/tcp open microsoft-ds
752/tcp open qrh
Nmap finished: 1 IP address (1 host up) scanned in 0.210 seconds
[root@localhost ~]#

 

You can clearly see the port 9898 is not shown in nmap scanning result, although port is open but not showing.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.