When merchant ships sail through pirate waters at night they shine very bright lights aft and have fire hoses running full blast over the transom.
One other trick pirates used was to run two boats with a line between them in front of an on coming ship. A short little Nantucket sleigh ride and they would have a boat positiond on both sides of the ship.
Yep. The long rope across the bow also works at anchor. We used to plan demo charges that would result in an explosion on each side of a ship. Just get up-current of an anchored ship and let them go.