16.04 上的 telnet

16.04 上的 telnet

我正在运行一个系统xenial,我需要验证特定端口是否打开,127.0.0.1因此我决定安装telnet以尝试连接到该特定端口。

I've tried the following:
ron@regDesktopHome:/etc/ssl/certs$ sudo apt-get install telnetd -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
telnetd is already the newest version (0.17-40).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
ron@regDesktopHome:/etc/ssl/certs$ sudo systemctl status inetd
● xinetd.service - LSB: Starts or stops the xinetd daemon.
   Loaded: loaded (/etc/init.d/xinetd; bad; vendor preset: enabled)
   Active: active (running) since Sun 2019-06-09 18:02:19 PDT; 10min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 2050 ExecStop=/etc/init.d/xinetd stop (code=exited, status=0/SUCCESS)
  Process: 2062 ExecStart=/etc/init.d/xinetd start (code=exited, status=0/SUCCESS)
    Tasks: 1
   Memory: 192.0K
      CPU: 22ms
   CGroup: /system.slice/xinetd.service
           └─2080 /usr/sbin/xinetd -pidfile /run/xinetd.pid -stayalive -inetd_compat -inetd_ipv6

Jun 09 18:02:19 regDesktopHome xinetd[2080]: removing daytime
Jun 09 18:02:19 regDesktopHome xinetd[2080]: removing daytime
Jun 09 18:02:19 regDesktopHome xinetd[2080]: removing discard
Jun 09 18:02:19 regDesktopHome xinetd[2080]: removing discard
Jun 09 18:02:19 regDesktopHome xinetd[2080]: removing echo
Jun 09 18:02:19 regDesktopHome xinetd[2080]: removing echo
Jun 09 18:02:19 regDesktopHome xinetd[2080]: removing time
Jun 09 18:02:19 regDesktopHome xinetd[2080]: removing time
Jun 09 18:02:19 regDesktopHome xinetd[2080]: xinetd Version 2.3.15 started with libwrap loadavg options compiled in.
Jun 09 18:02:19 regDesktopHome xinetd[2080]: Started working: 1 available service
ron@regDesktopHome:/etc/ssl/certs$ telnet 127.0.0.1
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
ron@regDesktopHome:/etc/ssl/certs$ 

这是怎么回事?为什么我无法连接localhost telnet

答案1

nmaplsof只是检查端口的两种较好的方法。

要查看端口 1-100,

sudo nmap -p1-100 localhost

要查看哪个进程打开了端口80

lsof -i tcp:80

当然读man nmap;man lsof

相关内容