Sharon Selfer Casey, clerk magistrate of the Cambridge District Court, made the ruling after The Boston Globe and other media outlets challenged the private hearings.
Last month, federal authorities made national news when they arrested three people on charges that they were running brothels out of Cambridge, Watertown, and the Washington, D.C., suburbs catering to a wealthy and well-connected clientele.