Captain of the port
In the Royal Navy, the captain of the port is the officer, usually with the rank of captain, responsible for the day-to-day running of a Naval Dockyard under the authority of the admiral-superintendent. He usually also holds the position of Queen's or King's harbourmaster and was directly responsible for the captain's department, which among other things operated the yard craft.
To some extent the role of captain of the port is analogous to that of a harbourmaster.
In the United States, captain of the port (COTP) is a title held by a United States Coast Guard officer, usually the commander of a United States Coast Guard sector with the rank of captain (O-6). Captain of the port duties involve enforcing within their respective areas port safety and security and marine environmental protection regulations, including regulations for the protection and security of vessels, harbors, and waterfront facilities; anchorages; security zones; safety zones; regulated navigation areas; deepwater ports; water pollution; and ports and waterways safety.