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 of America, Captain of the Port (COTP) is a title held by a U.S. 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.