WASHINGTON — President Trump took a second highly public swipe at Attorney General Jeff Sessions on Monday, an apparent attempt to influence Justice Department investigations that challenged Mr. Sessions’s longstanding view that the agency’s work should be free from political sway.

Mr. Trump called Mr. Sessions “beleaguered” and questioned on Twitter why the department was not investigating Hillary Clinton.

The Run-Up

The podcast that makes sense of the most delirious stretch of the 2016 campaign.

The president’s remarks came days after he told The New York Times he regretted appointing Mr. Sessions in light of his recusal from the Russia inquiry encircling the White House. Sarah Huckabee Sanders, the White House press secretary, repeated later on Monday that Mr. Trump was disappointed in Mr. Sessions’s recusal.

“He would hope the Department of Justice would look into any other potential area where the law could have been broken,” she said of his Twitter post about Mrs. Clinton.

Sarah Isgur Flores, a spokeswoman for Mr. Sessions, declined to comment on the president’s latest rebuke but said the attorney general had lunch at the White House hours after the president’s Twitter post, a weekly meeting attended typically by the White House counsel but not Mr. Trump himself.

The fractured relationship between the president and Mr. Sessions — one of Mr. Trump’s earliest supporters — has prompted speculation about how long he may endure, particularly given that Mr. Sessions offered Mr. Trump his resignation months ago.

Rudolph W. Giuliani, the former mayor of New York, denied a report on Monday that he was being considered as a replacement for Mr. Sessions and expressed support for him, telling CNN he “made the right choice” to recuse himself from the Russia inquiry.

Mr. Sessions has been forceful in pressing the Trump administration’s agenda in its first six months, enacting hard-line policies on immigration and criminal charging and sentencing, and dismantling some significant legacies of the Obama administration.

Addressing federal prosecutors in Philadelphia on Friday, Mr. Sessions signaled that he wanted to charge ahead in enacting policy priorities “under Trump’s direction.”

Key constituencies, including many members of law enforcement, said they had no desire to see the Justice Department’s leadership upended. “From our standpoint, the attorney general is doing a fine job in furtherance of the president’s agenda,” said James Pasco, senior adviser to the president of the Fraternal Order of Police.

He said the president had “made exactly the right choice for attorney general.”

Mr. Sessions has underscored his subordinacy to Mr. Trump in recent days, standing in contrast to the emphasis he has placed for years on the independence of Justice Department officials.

As a longtime member of the Senate Judiciary Committee during his years as a Republican senator from Alabama, Mr. Sessions repeatedly asked Justice Department nominees to pledge their independence from the president.

In 2015, in questioning Sally Q. Yates ahead of her confirmation as deputy attorney general, Mr. Sessions made clear that he believed the Justice Department should push back if the president ever issued an “improper” directive. “You have to watch out because people will be asking you to do things,” Mr. Sessions said, “and you need to say no.”

At his own confirmation hearing in January, he repeated that belief.

“The office of attorney general is not a normal political office,” Mr. Sessions said. “He or she cannot be a mere rubber stamp.”

While the Justice Department is part of the executive branch, longstanding practice has been for it to operate free from interference by the White House.

“There’s no regulation anywhere that says the president can’t tell the attorney general to drop an investigation or start an investigation,” said Matthew Miller, a former spokesman for the department under the Obama administration. “But independence is so ingrained in the culture of D.O.J. It’s the norm that’s developed over time.”

Mr. Trump has criticized how the Justice Department defended some of his policies, including his ban on travelers from certain predominantly Muslim countries. In recent weeks, the president trained his attacks not just on Mr. Sessions, who recused himself from the Russia inquiry in March, but also on his deputy, Rod J. Rosenstein, who appointed a special counsel to lead that inquiry in May.

If Mr. Sessions were to resign or be fired, Mr. Trump could use a procedural step to name a replacement who would allow the president to assert greater control over the special counsel investigation into his campaign’s contacts with Russia.

With the Senate due to leave for its annual August recess, a possible path exists for Mr. Trump to use a recess appointment clause to name a successor and circumvent the typical confirmation process. Although the Senate majority leader, Mitch McConnell, Republican of Kentucky, has decided to cut the break short, should it last at least 10 days, Mr. Trump would have constitutional authority to unilaterally fill any vacant position that normally requires Senate confirmation, which includes the post of attorney general.

That step would allow Mr. Trump to evade congressional demands that his pick make assurances about the Russia investigation as a condition of confirmation, said Stephen Vladeck, a University of Texas, Austin, law professor.

Under a recess appointment, an attorney general could stay in that role until January 2019 and would oversee the special counsel.

“The recess appointments clause would allow Trump, at least constitutionally, to put just about anybody into Sessions’s job, including someone who would have no qualms about firing the special counsel,” Mr. Vladeck said. “Then the question is not whether there would be any legal response, because that is perfectly within the president’s power, but whether that alienates congressional Republicans.”

Congressional Republicans could block such a move by refusing to let the Senate go into a lengthy recess. The Supreme Court ruled in 2014 that a recess must be at least 10 days to prompt the president’s recess-appointment powers, and lawmakers of both parties, under the Bush and Obama administrations, have used their control of at least one chamber to block presidents from making such unilateral appointments.

That tactic involves sending a single senator into the otherwise empty chamber to bang the gavel every few days during a lengthy vacation, breaking up the long recess into a series of short ones — each too brief to trigger the president’s powers. The court’s 2014 ruling deemed such “pro forma” sessions to be real for the purpose of preventing recess appointments.

However, Congress has never done so when both chambers and the White House are controlled by the same party.

Mr. Trump could also simply let Mr. Rosenstein become acting attorney general until a successor was confirmed, or he could seek to temporarily fill the position with any other Senate-confirmed official from elsewhere in the government under the Vacancies Act.

Mr. Sessions vowed last week to serve “as long as that is appropriate.”