Linux

在 Linux/Debian 上打開埠 7(回顯埠)

  • May 12, 2017

我需要在我的 Linux/Debian 上安裝一個回顯伺服器來進行調試,我意識到“/etc/services”中已經顯示了一個分配的埠來執行此操作,它是埠 7 TCP/UDP。

是否可以在 Linux (Debian) 上打開此埠?如果沒有,有什麼替代方案?

要在 Debian 中設置 echo 服務,您可以安裝xinetd

apt-get install xinetd

比你必須將disable指令更改為noin /etc/xinetd.d/echo; 或者如果該文件不存在,則創建它,如下所示:

# 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
}

設置disable = no或創建文件後,重新啟動xinetd

sudo service xinetd restart

測試echoTCP 服務:

$nc localhost echo
testing...
testing...
xxxx
xxxx
^C

引用自:https://unix.stackexchange.com/questions/361698