President Trump said Tuesday that he knows the identity of “Anonymous,” the administration insider who has penned an op-ed and a book critical of him.

But after an internal search for the culprit, Mr. Trump won’t say who it is.

“I know who it is,” Mr. Trump told reporters. “I know all about Anonymous. We know a lot.”

The unidentified person wrote an op-ed in the New York Times in 2018 under the headline, “I Am Part of the Resistance Inside the Trump Administration.” The person also wrote a book last year with further criticism and the despairing counsel that efforts by people surrounding Mr. Trump to rein him in cannot succeed.

Politico reported that deputy White House national security adviser Victoria Coates has been the subject of a whisper campaign among Trump allies who have sought to tie her to Anonymous.

The report prompted the publisher of the book to deny publicly that Mrs. Coates is the author.

This week, Axios reported that Mrs. Coates may be moved to the Energy Department amid the backlash. White House press secretary Stephanie Grisham wouldn’t confirm that during an appearance on “Fox & Friends” on Tuesday.

“I don’t know if that’s something that’s going to happen, if that’s something that she wants to happen,” Ms. Grisham said. “I don’t know what’s going to happen in terms of that particular employee.”

But she indicated the White House has been searching to uncover the person’s identity.

“Whoever wrote the Anonymous book is a coward and whoever wrote the Anonymous book and the op-ed, they do need to be found,” she said. “The fact that they’re working in government against the president and essentially against the American people is not good.”

Mrs. Coates is not the first person to be fingered as “Anonymous.”

Last November, the New Republic suggested the person might be former Pentagon speechwriter Guy Snodgrass, based on similarities between Anonymous’s writings and a book Mr. Snodgrass had written.

When a Fox News host asked Mr. Snodgrass directly “are you ‘Anonymous’?” he replied that it was a “great question,” and issued the nondenial that “if I was going to make an announcement like that I would come into the studio with you in New York City.”