How to assign a different context to a port with pre-existing SELinux context as per default policy?

Solution Verified - Updated -

Issue

  • A port is mapped with pre-existing SELinux context:

    • Attempting to remove the context fails
    # semanage port -d -t printer_port_t -p tcp 515
    ValueError: Port tcp/515 is defined in policy, cannot be deleted
    
    • Attempting to add a new context fails
    # semanage port -d -t printer_port_t -p tcp 515
    ValueError: Port tcp/515 is already defined.
    

Environment

  • Red Hat Enterprise Linux 8
  • SELinux

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content