• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

Linux OS Service ‘portreserve’

by admin

The portreserve program aims to help services with well-known ports that lie in the portmap range. It prevents portmap from a real service’s port by occupying it itself, until the real service tells it to release the port (generally in the init script).

For example the cups package provides /etc/portreserve/cups.

# cat /etc/portreserve/cups 
ipp

In /etc/services, it is defined “service-name ipp” is equal to 631 ports. When portreserve service starts, portreserve reserves 631 ports.

# cat /etc/services | grep -w ipp
ipp             631/tcp                         # Internet Printing Protocol
ipp             631/udp                         # Internet Printing Protocol
# netstat -lanp | grep 631
udp        0      0 0.0.0.0:631                 0.0.0.0:*                               1628/portreserve

Configuration Files

– /etc/portreserve/* – Service configuration files
– /var/run/portreserve/socket – communication socket for portrelease

What happens when portrelease daemon starts

When the portreserve daemon is started, it examines the /etc/portreserve/ directory. Each file not containing “.” or “~” in its name is considered to be a service configuration file, and must contain a service name (as listed in /etc/services) or a port number. UDP services may be specified by appending “/udp” to the service name, and TCP services by “/tcp“. Several services may be specified, one per line.

For example, /etc/portreserve/cups might contain the string “ipp” or, equivalently, “ipp/tcp” and “ipp/udp” on separate lines.

For each service configuration file, a socket is created and bound to the appropriate port. A service wishing to bind to its port must first run portrelease, which instructs portreserve to release the port associated with the service.

Once all the reserved ports have been released, the daemon exits.

Filed Under: Linux, Linux Services

Some more articles you might also be interested in …

  1. cryptcat: command not found
  2. How to Create and Query a BTRFS File System
  3. mknod Command Examples in Linux
  4. How to Disable Daylight Savings Time (DST), and Modify the Timezone on Linux
  5. id Command Examples in Linux
  6. Audit rules for monitoring Copy, move, delete and kill Commands In Linux
  7. vgextend Command Examples in Linux
  8. Beginners Guide to DHCP – Install and configure DHCP server and client
  9. chcon: command not found
  10. lxterminal Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • batch: Execute commands at a later time when the system load levels permit
  • bat: Print and concatenate files
  • bastet: Clone of the game Tetris in the terminal
  • bashmarks: Save and jump to commonly used directories using 1 character commands

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright