Which field(s) can be a key in the table in /etc/services?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












0















In /etc/services, a service name can have multiple (transport protocol, port number) pairs. For example, The Linux Programming Interface says:




The /etc/services file consists of lines containing three columns,
as shown in the following examples:



# Service name port/protocol [aliases]

http 80/tcp # Hypertext Transfer Protocol
http 80/udp
ssh 22/tcp # Secure Shell
ssh 22/udp
telnet 23/tcp # Telnet
telnet 23/udp
smtp 25/tcp # Simple Mail Transfer Protocol
smtp 25/udp



Which field(s) can be a key in the table?



The example shows a service name can correspond to more than one transport protocols.



Given a service name and a transport protocol, can they correspond to more than one port numbers? In other words, can a service listen at two ports in the same transport protocol?



Thanks.










share|improve this question


























    0















    In /etc/services, a service name can have multiple (transport protocol, port number) pairs. For example, The Linux Programming Interface says:




    The /etc/services file consists of lines containing three columns,
    as shown in the following examples:



    # Service name port/protocol [aliases]

    http 80/tcp # Hypertext Transfer Protocol
    http 80/udp
    ssh 22/tcp # Secure Shell
    ssh 22/udp
    telnet 23/tcp # Telnet
    telnet 23/udp
    smtp 25/tcp # Simple Mail Transfer Protocol
    smtp 25/udp



    Which field(s) can be a key in the table?



    The example shows a service name can correspond to more than one transport protocols.



    Given a service name and a transport protocol, can they correspond to more than one port numbers? In other words, can a service listen at two ports in the same transport protocol?



    Thanks.










    share|improve this question
























      0












      0








      0








      In /etc/services, a service name can have multiple (transport protocol, port number) pairs. For example, The Linux Programming Interface says:




      The /etc/services file consists of lines containing three columns,
      as shown in the following examples:



      # Service name port/protocol [aliases]

      http 80/tcp # Hypertext Transfer Protocol
      http 80/udp
      ssh 22/tcp # Secure Shell
      ssh 22/udp
      telnet 23/tcp # Telnet
      telnet 23/udp
      smtp 25/tcp # Simple Mail Transfer Protocol
      smtp 25/udp



      Which field(s) can be a key in the table?



      The example shows a service name can correspond to more than one transport protocols.



      Given a service name and a transport protocol, can they correspond to more than one port numbers? In other words, can a service listen at two ports in the same transport protocol?



      Thanks.










      share|improve this question














      In /etc/services, a service name can have multiple (transport protocol, port number) pairs. For example, The Linux Programming Interface says:




      The /etc/services file consists of lines containing three columns,
      as shown in the following examples:



      # Service name port/protocol [aliases]

      http 80/tcp # Hypertext Transfer Protocol
      http 80/udp
      ssh 22/tcp # Secure Shell
      ssh 22/udp
      telnet 23/tcp # Telnet
      telnet 23/udp
      smtp 25/tcp # Simple Mail Transfer Protocol
      smtp 25/udp



      Which field(s) can be a key in the table?



      The example shows a service name can correspond to more than one transport protocols.



      Given a service name and a transport protocol, can they correspond to more than one port numbers? In other words, can a service listen at two ports in the same transport protocol?



      Thanks.







      linux services






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 13 at 21:41









      TimTim

      27.5k78264476




      27.5k78264476




















          1 Answer
          1






          active

          oldest

          votes


















          3














          The file is described in the services(5) manpage, and its usage in the related functions’ manpage. The latter shows that the following pairs are expected to be keys:



          • name and protocol;

          • port number and protocol.

          Note that services can have aliases (which your example doesn’t illustrate). www for instance is typically an alias for http:



          http 80/tcp www # WorldWideWeb HTTP


          Regarding what services can do, /etc/services only provides a mapping, it doesn’t constrain anything. Thus, someone asking for http on TCP will be told that the corresponding assigned port is 80, but an HTTP dæmon can listen on any port it wants to (and is allowed to); likewise, someone asking for port 80 on TCP will be told that the corresponding name is http, but that doesn’t mean that a server listening on port 80 has to be an HTTP server. Furthermore, single processes can listen on multiple ports, and on BSDs and Linux since kernel 3.9, multiple processes can listen on the same port.






          share|improve this answer

























          • Thanks. "can a service listen at two ports in the same transport protocol?"

            – Tim
            Feb 13 at 21:53












          • The key (uniqueness) requirement answers that, doesn’t it?

            – Stephen Kitt
            Feb 13 at 21:54











          • Is it correct that a service can only listen at one port in a transport protocol, and a process can listen at two ports in the same transport protocol (so the process actually runs two services)?

            – Tim
            Feb 13 at 21:56












          • Can a service have two ports in the same transport protocol for its listening purpose?

            – Tim
            Feb 13 at 22:19






          • 1





            We’ve gone a long way from “which field(s) can be a key in the table in /etc/services?” at this point...

            – Stephen Kitt
            Feb 14 at 17:43










          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f500497%2fwhich-fields-can-be-a-key-in-the-table-in-etc-services%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          The file is described in the services(5) manpage, and its usage in the related functions’ manpage. The latter shows that the following pairs are expected to be keys:



          • name and protocol;

          • port number and protocol.

          Note that services can have aliases (which your example doesn’t illustrate). www for instance is typically an alias for http:



          http 80/tcp www # WorldWideWeb HTTP


          Regarding what services can do, /etc/services only provides a mapping, it doesn’t constrain anything. Thus, someone asking for http on TCP will be told that the corresponding assigned port is 80, but an HTTP dæmon can listen on any port it wants to (and is allowed to); likewise, someone asking for port 80 on TCP will be told that the corresponding name is http, but that doesn’t mean that a server listening on port 80 has to be an HTTP server. Furthermore, single processes can listen on multiple ports, and on BSDs and Linux since kernel 3.9, multiple processes can listen on the same port.






          share|improve this answer

























          • Thanks. "can a service listen at two ports in the same transport protocol?"

            – Tim
            Feb 13 at 21:53












          • The key (uniqueness) requirement answers that, doesn’t it?

            – Stephen Kitt
            Feb 13 at 21:54











          • Is it correct that a service can only listen at one port in a transport protocol, and a process can listen at two ports in the same transport protocol (so the process actually runs two services)?

            – Tim
            Feb 13 at 21:56












          • Can a service have two ports in the same transport protocol for its listening purpose?

            – Tim
            Feb 13 at 22:19






          • 1





            We’ve gone a long way from “which field(s) can be a key in the table in /etc/services?” at this point...

            – Stephen Kitt
            Feb 14 at 17:43















          3














          The file is described in the services(5) manpage, and its usage in the related functions’ manpage. The latter shows that the following pairs are expected to be keys:



          • name and protocol;

          • port number and protocol.

          Note that services can have aliases (which your example doesn’t illustrate). www for instance is typically an alias for http:



          http 80/tcp www # WorldWideWeb HTTP


          Regarding what services can do, /etc/services only provides a mapping, it doesn’t constrain anything. Thus, someone asking for http on TCP will be told that the corresponding assigned port is 80, but an HTTP dæmon can listen on any port it wants to (and is allowed to); likewise, someone asking for port 80 on TCP will be told that the corresponding name is http, but that doesn’t mean that a server listening on port 80 has to be an HTTP server. Furthermore, single processes can listen on multiple ports, and on BSDs and Linux since kernel 3.9, multiple processes can listen on the same port.






          share|improve this answer

























          • Thanks. "can a service listen at two ports in the same transport protocol?"

            – Tim
            Feb 13 at 21:53












          • The key (uniqueness) requirement answers that, doesn’t it?

            – Stephen Kitt
            Feb 13 at 21:54











          • Is it correct that a service can only listen at one port in a transport protocol, and a process can listen at two ports in the same transport protocol (so the process actually runs two services)?

            – Tim
            Feb 13 at 21:56












          • Can a service have two ports in the same transport protocol for its listening purpose?

            – Tim
            Feb 13 at 22:19






          • 1





            We’ve gone a long way from “which field(s) can be a key in the table in /etc/services?” at this point...

            – Stephen Kitt
            Feb 14 at 17:43













          3












          3








          3







          The file is described in the services(5) manpage, and its usage in the related functions’ manpage. The latter shows that the following pairs are expected to be keys:



          • name and protocol;

          • port number and protocol.

          Note that services can have aliases (which your example doesn’t illustrate). www for instance is typically an alias for http:



          http 80/tcp www # WorldWideWeb HTTP


          Regarding what services can do, /etc/services only provides a mapping, it doesn’t constrain anything. Thus, someone asking for http on TCP will be told that the corresponding assigned port is 80, but an HTTP dæmon can listen on any port it wants to (and is allowed to); likewise, someone asking for port 80 on TCP will be told that the corresponding name is http, but that doesn’t mean that a server listening on port 80 has to be an HTTP server. Furthermore, single processes can listen on multiple ports, and on BSDs and Linux since kernel 3.9, multiple processes can listen on the same port.






          share|improve this answer















          The file is described in the services(5) manpage, and its usage in the related functions’ manpage. The latter shows that the following pairs are expected to be keys:



          • name and protocol;

          • port number and protocol.

          Note that services can have aliases (which your example doesn’t illustrate). www for instance is typically an alias for http:



          http 80/tcp www # WorldWideWeb HTTP


          Regarding what services can do, /etc/services only provides a mapping, it doesn’t constrain anything. Thus, someone asking for http on TCP will be told that the corresponding assigned port is 80, but an HTTP dæmon can listen on any port it wants to (and is allowed to); likewise, someone asking for port 80 on TCP will be told that the corresponding name is http, but that doesn’t mean that a server listening on port 80 has to be an HTTP server. Furthermore, single processes can listen on multiple ports, and on BSDs and Linux since kernel 3.9, multiple processes can listen on the same port.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Feb 14 at 6:45

























          answered Feb 13 at 21:47









          Stephen KittStephen Kitt

          175k24400477




          175k24400477












          • Thanks. "can a service listen at two ports in the same transport protocol?"

            – Tim
            Feb 13 at 21:53












          • The key (uniqueness) requirement answers that, doesn’t it?

            – Stephen Kitt
            Feb 13 at 21:54











          • Is it correct that a service can only listen at one port in a transport protocol, and a process can listen at two ports in the same transport protocol (so the process actually runs two services)?

            – Tim
            Feb 13 at 21:56












          • Can a service have two ports in the same transport protocol for its listening purpose?

            – Tim
            Feb 13 at 22:19






          • 1





            We’ve gone a long way from “which field(s) can be a key in the table in /etc/services?” at this point...

            – Stephen Kitt
            Feb 14 at 17:43

















          • Thanks. "can a service listen at two ports in the same transport protocol?"

            – Tim
            Feb 13 at 21:53












          • The key (uniqueness) requirement answers that, doesn’t it?

            – Stephen Kitt
            Feb 13 at 21:54











          • Is it correct that a service can only listen at one port in a transport protocol, and a process can listen at two ports in the same transport protocol (so the process actually runs two services)?

            – Tim
            Feb 13 at 21:56












          • Can a service have two ports in the same transport protocol for its listening purpose?

            – Tim
            Feb 13 at 22:19






          • 1





            We’ve gone a long way from “which field(s) can be a key in the table in /etc/services?” at this point...

            – Stephen Kitt
            Feb 14 at 17:43
















          Thanks. "can a service listen at two ports in the same transport protocol?"

          – Tim
          Feb 13 at 21:53






          Thanks. "can a service listen at two ports in the same transport protocol?"

          – Tim
          Feb 13 at 21:53














          The key (uniqueness) requirement answers that, doesn’t it?

          – Stephen Kitt
          Feb 13 at 21:54





          The key (uniqueness) requirement answers that, doesn’t it?

          – Stephen Kitt
          Feb 13 at 21:54













          Is it correct that a service can only listen at one port in a transport protocol, and a process can listen at two ports in the same transport protocol (so the process actually runs two services)?

          – Tim
          Feb 13 at 21:56






          Is it correct that a service can only listen at one port in a transport protocol, and a process can listen at two ports in the same transport protocol (so the process actually runs two services)?

          – Tim
          Feb 13 at 21:56














          Can a service have two ports in the same transport protocol for its listening purpose?

          – Tim
          Feb 13 at 22:19





          Can a service have two ports in the same transport protocol for its listening purpose?

          – Tim
          Feb 13 at 22:19




          1




          1





          We’ve gone a long way from “which field(s) can be a key in the table in /etc/services?” at this point...

          – Stephen Kitt
          Feb 14 at 17:43





          We’ve gone a long way from “which field(s) can be a key in the table in /etc/services?” at this point...

          – Stephen Kitt
          Feb 14 at 17:43

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f500497%2fwhich-fields-can-be-a-key-in-the-table-in-etc-services%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown






          Popular posts from this blog

          Peggy Mitchell

          Palaiologos

          The Forum (Inglewood, California)