3

Whenever I think I'm getting comfortable with Linux, I get stumped by a simple problem that exposes my inexperience: how do I launch the daytime service? My trail of attempts is as follows:

>sudo systemctl start daytime
Failed to issue method call: Unit daytime.service failed to load: No such file or directory.
>which daytime
/usr/bin/which: no daytime in (/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/home/user/utils/:/home/user/.local/bin:/home/user/bin:/home/user/utils/:/home/user/utils/:/home/user/utils/:/home/user/.local/bin:/home/user/bin:/home/user/utils/)
>locate daytime
/etc/xinetd.d/daytime-dgram
/etc/xinetd.d/daytime-stream
>sudo systemctl start daytime-stream
Failed to issue method call: Unit daytime-stream.service failed to load: No such file or directory.
>systemctl status xinetd
xinetd.service - Xinetd A Powerful Replacement For Inetd
   Loaded: loaded (/usr/lib/systemd/system/xinetd.service; enabled)
   Active: active (running) since Mon 2017-06-12 18:10:28 PDT; 16h ago
  Process: 5005 ExecStart=/usr/sbin/xinetd -stayalive -pidfile /var/run/xinetd.pid $EXTRAOPTIONS (code=exited, status=0/SUCCESS)
 Main PID: 5006 (xinetd)
   CGroup: /system.slice/xinetd.service
            /usr/sbin/xinetd -stayalive -pidfile /var/run/xinetd.pid
>uname -a
Linux linuxbox 3.11.10-301.fc20.x86_64 #1 SMP Thu Dec 5 14:01:17 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

I have a very shaky understanding that there is some relationship between xinetd and daytime, but, e.g., I don't understand if the fact that the xinetd service is running means that daytime is/should also be running, or if I need to start it independently? If I am supposed to start it independently, then how can I? I'm out of ideas after my above-noted attempts all failed.

  • 1
    Please try this: edit the file /etc/xinetd.d/daytime-stream. In that file, change the line disable from yes to no. Then do sudo systemctl restart xinetd. You will then be able to telnet 127.0.0.1 13 and get the output. – KevinO Jun 13 '17 at 18:22
  • @Theophrastus - actually this question is a follow-up to unix.stackexchange.com/questions/370920/… . I don't specifically want to achieve NTP time sync; rather I just wanted to achieve a telnet connection to the daytime service because some learning material I am studying suggested this was possible. – StoneThrow Jun 13 '17 at 18:25
  • @KevinO - Thank you: your recommendation was right on. After following your suggestions, I re-ran netstat -nlt and now I saw an entry for tcp6 0 0 :::13 :::* LISTEN. After this, I re-ran telnet 127.0.0.1 13 and at last saw output that matched my study material. I'll add what I learned from this exercise to my bag of tricks - thank you. (You may want to post as an answer if you'd like the reputation points) – StoneThrow Jun 13 '17 at 18:31
  • @KevinO - If this is not too off-topic, I'm just curious: do you know why the 'Local Address' field is shown as :::13 instead of 127.0.0.1:13 ? I see a mix of both styles in the netstat -nlt output. – StoneThrow Jun 13 '17 at 18:34
  • 1
    The :::13 is IPv6 on the local machine (I don't recall the rules for when one can omit part of the address in IPv6). The other entry 127.0.0.1:### is for IPv4. IIRC, the :::13 is indicating an IPv6 binding for for all addresses on port 13. In contrast, you might see ::1:25 which is binding the smtp service to localhost on port 25. You can see the ::1 in the /etc/hosts file (for localhost). – KevinO Jun 13 '17 at 18:40
4

The xinetd daemon essentially listens for requests and then launches given service for it. Wikipedia entry for xinetd.

From the OP's question, one can see /etc/xindet.d/daytime-stream, which means that xinetd is installed, along with the daytime service. However, as it is generally recommended for daytime to not be enabled see, e.g., acunetix and security scanning, it must be specifically enabled. To enable it, edit the file /etc/xinetd.d/daytime-stream and change the disabled from 'yes' to 'no` (backwards logic is backwards).

After restarting the xinetd via sudo systemctl xinetd restart (or equivalent), the xinetd daemon will start the service when a request is made on the port. The mapping between the port and the service is defined in /etc/services (but may be specified in the relevant xinetd file).

  • From the wikipedia article: "xinetd listens for incoming requests over a network and launches the appropriate service for that request." Does this mean, e.g. it listens for "telnet requests" and if one arrives, then it launches telnetd? – StoneThrow Jun 14 '17 at 1:47
  • 1
    @StoneThrow, configured correctly, I believe xinetd can start the telnet or ssh daemon, but I do not believe it is the normal use-case (certainly not for ssh on modern distributions). Many/most services are started through (now) systemd. I think an interesting question you might pose (and which I am not qualified to answer) is the evolution of service starting/monitoring between xinetd/sysV init/systemd. xinetd wasn't installed by default on my CentOS 7 machine, and I haven't used or configured it in years. – KevinO Jun 14 '17 at 13:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.