opening port 7 (echo port) on Linux/Debian

5,874

For setting up a echo service in Debian, you can install xinetd with:

apt-get install xinetd

Than you have to change the disable directive to no in /etc/xinetd.d/echo; or if the file does not exist, create it as shown here:

# default: off
# description: An xinetd internal service which echo's characters back to
# clients.
# This is the tcp version.
service echo
{
    disable     = no
    type        = INTERNAL
    id      = echo-stream
    socket_type = stream
    protocol    = tcp
    user        = root
    wait        = no
}

# This is the udp version.
service echo
{
    disable     = yes
    type        = INTERNAL
    id      = echo-dgram
    socket_type = dgram
    protocol    = udp
    user        = root
    wait        = yes
}

After setting disable = no, or creating the file, your restart xinetd with:

sudo service xinetd restart

To test the echo TCP service:

$nc localhost echo
testing...
testing...
xxxx
xxxx
^C
Share:
5,874

Related videos on Youtube

Brian Salehi
Author by

Brian Salehi

A programmer who rarely uses StackOverflow.

Updated on September 18, 2022

Comments

  • Brian Salehi
    Brian Salehi over 1 year

    I need an echo server on my Linux/Debian for debugging purposes , I realized that there is an assigned port shown in '/etc/services' to do that already and it's port 7 TCP/UDP.

    Is it possible to open this port on Linux (Debian)? if not, what are alternatives?

    • Stephen Kitt
      Stephen Kitt about 7 years
      Not quite a duplicate, but the linked question contains the answer to this one.
    • Rui F Ribeiro
      Rui F Ribeiro about 7 years
      Why the echo service?
    • Brian Salehi
      Brian Salehi about 7 years
      @StephenKitt unfortunately there is no 'inetd.conf' file in '/etc', I guess this file can be found in RH not Debian. there should be a new method to enable this service
    • Brian Salehi
      Brian Salehi about 7 years
      @RuiFRibeiro just learning Linux network programming,simplest client codes can send a string to an echo server and receive it. there should be an echo server to test the client.
    • Stephen Kitt
      Stephen Kitt about 7 years
      @Rui I wouldn’t any more, but each to his own :-).
    • Brian Salehi
      Brian Salehi about 7 years
      @RuiFRibeiro now I remember xinetd I worked with it years ago! helped a lot thanks
    • Rui F Ribeiro
      Rui F Ribeiro about 7 years
      I added an answer.
  • Stephen Kitt
    Stephen Kitt about 7 years
    It’s not a good idea to enable UDP echo...
  • Rui F Ribeiro
    Rui F Ribeiro about 7 years
    @StephenKitt Indeed, it was as an example, however from a security point of view is generally a bad ideia. Edited the answer.