When Mr. Obama was elected in 2008, press freedom groups had high expectations for the former constitutional law professor, particularly after the press had suffered through eight years of bitter confrontation with the Bush administration. But today, many of those same groups say Mr. Obama’s record of going after both journalists and their sources has set a dangerous precedent that Mr. Trump can easily exploit. “Obama has laid all the groundwork Trump needs for an unprecedented crackdown on the press,” said Trevor Timm, executive director of the nonprofit Freedom of the Press Foundation.

Dana Priest, a Pulitzer Prize-winning reporter for The Washington Post, added: “Obama’s attorney general repeatedly allowed the F.B.I. to use intrusive measures against reporters more often than any time in recent memory. The moral obstacles have been cleared for Trump’s attorney general to go even further, to forget that it’s a free press that has distinguished us from other countries, and to try to silence dissent by silencing an institution whose job is to give voice to dissent.”

The administration’s heavy-handed approach represents a sharp break with tradition. For decades, official Washington did next to nothing to stop leaks. Occasionally the C.I.A. or some other agency, nettled by an article or broadcast, would loudly proclaim that it was going to investigate a leak, but then would merely go through the motions and abandon the case.

Of course, reporters and sources still had to be careful to avoid detection by the government. But leak investigations were a low priority for the Justice Department and the F.B.I. In fact, before the George W. Bush administration, only one person was ever convicted under the Espionage Act for leaking — Samuel Morison, a Navy analyst arrested in 1984 for giving spy satellite photos of a Soviet aircraft carrier to Jane’s Defense Weekly. He was later pardoned by President Bill Clinton.

Things began to change in the Bush era, particularly after the Valerie Plame case. The 2003 outing of Ms. Plame as a covert C.I.A. operative led to a criminal leak investigation, which in turn led to a series of high-profile Washington journalists being subpoenaed to testify before a grand jury and name the officials who had told them about her identity. Judith Miller, then a New York Times reporter, went to jail for nearly three months before finally testifying in the case.

The Plame case began to break down the informal understanding between the government and the news media that leaks would not be taken seriously.