How-To Connect Remotely via Telnet

Alexey Eremenko "Technologov"

$Revision: 06 $

$Date: 2007-01-26 $

About

Telnet (TELetype NETwork) is a very old open-standards client/server protocol, that allows for text-based remote-access. It's advantage is: that it is fast and supported by almost all Operating Systems, that support TCP/IP. Telnet is TCP/IP based, and replaces the older, non-IP based, RS-232 remote-access networks. Unfortunately, this protocol is insecure and, therefore, is strongly not recommended to be used over the Internet.

On modern networks, Telnet is replaced by SSH for security reasons.

This document describes how to configure openSUSE as a telnet server, and how to connect to other telnet servers.

Procedure for Telnet Client

To connect to others use: (as normal user)

telnet 127.0.0.1

the 127.0.0.1 can be any IP address or DNS name.

Procedure for Telnet Server

  1. First enter root mode, by using the command su. then we must check if our software is installed:

    # rpm -q telnet telnet-server
    telnet-1.2-33
    telnet-server-1.2-33
    
  2. The output above shows packages versions, which means both are installed. If not, then install them first with Yast. Fortunately, telnet client and server packages are included with openSUSE.

    After the packages installed, use this command to configure Telnet server:

    # chkconfig telnet on
    # rcxinetd restart
    # chkconfig xinetd on
    
  3. If your firewall is on (default openSUSE setup), you must configure your firewall to accept TCP Port 23, to allow Telnet traffic to pass from remote computers. To do so:

    Yast Control Center->Security and Users->Firewall->Allowed Services->Advanced->TCP Ports=23->OK->Next->Accept

Changing Telnet TCP Port on Client

On the telnet client, you simply type:

> telnet localhost 23

where 23 is your TCP port.

Changing Telnet TCP Port on Server

On telnet server, you must change the file "/etc/services", because by default it works via xinetd super-server. The standard telnet works on TCP port 23. Change the lines where port 23 is assigned to telnet to some other port. To find out on which lines it is, use:

# cat -n /etc/services | grep " 23/"
132  telnet           23/tcp    # Telnet
133  telnet           23/udp    # Telnet

Basically it reports, that you need to edit lines 132 and 133. To set the TCP port, change the value "23" on both lines to the desired one. Recommended values are between 1024...65535.

After that, restart the service with:

# rcxinetd restart

Enabling Remote Login for root

NOTE: Remote root login is disabled for a good reason. Don't do this unless you know exactly the possible consequences.

In normal case root isn't allowed to login over telnet (security reasons). To change this you have to edit the file "/etc/pam.d/login" and change :

auth     [user_unknown=ignore success=ok ignore=ignore auth_err=die default=bad]pam_securetty.so

to: (basically add "#" at start of line)

#auth     [user_unknown=ignore success=ok ignore=ignore auth_err=die default=bad]pam_securetty.so

After that, restart the service with:

# rcxinetd restart

Troubleshooting and Diagnostics

Telnet Server config file is located at: "/etc/xinetd.d/telnet".

See if the server is running:

# chkconfig --list

See which TCP port are open locally:

# nmap localhost

To use this, you must install nmap first.

Alternatively, you can see which post are listening by:

# netstat -ln | grep -vi unix

For More Information

Wikipedia page: http://en.wikipedia.org/wiki/TELNET.

original openSUSE wiki page: http://en.opensuse.org/Telnet_Server_HOWTO.

the command: telnet /? and respective man page.

Standard TCP/UDP port file is located at: "/etc/services".