O'Reilly logo

Practical UNIX and Internet Security, 3rd Edition by Alan Schwartz, Gene Spafford, Simson Garfinkel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Understanding Unix Internet Servers and Services

Most Unix network services are provided by individual programs called servers. For a server to operate, it must be assigned a protocol (e.g., TCP or UDP), be assigned a port number, and somehow be started.

The /etc/services File

As we saw in the last chapter, most Internet services are assigned a specific port for their exclusive use. When a client opens a connection across the network to a server, the client uses the port to specify which service it wishes to use. These ports are called well-known ports because they need to be known in advance by both the client and the server. Unix uses the /etc/services file as a small local database; for each service this file specifies the service’s well-known port number and notes whether the service is available as a TCP or UDP service. The /etc/services file is distributed as part of the Unix operating system.

The information in the /etc/services file is derived from Internet RFCs[132] and other sources. Some of the services listed in the /etc/services file are no longer in widespread use; nevertheless, their names still appear in the file.

The following is an excerpt from the /etc/services file that specifies the ports for the Telnet, SMTP, and Network Time Protocol (NTP) services:

# /etc/services
#
 . . . 
telnet 23/tcp
smtp   25/tcp mail
time   37/udp timeserver
 . . .

Each line gives the canonical name of the service, the port number and protocol, and any aliases for the service name. As ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required