Mr. Webb, now 72, graduated from the Naval Academy in 1968 and served in Vietnam as a Marine rifle platoon and company commander. He was wounded twice and awarded the Navy Cross, a prestigious award that ranks just below the Medal of Honor, along with other valor awards.In a 1979 opinion article in Washingtonian magazine titled “Women Can’t Fight,” Mr. Webb wrote that allowing women into the military — specifically in combat positions — would harm national defense. The article would haunt him throughout his political career, despite his changing views on the subject.The Pentagon opened all combat jobs to women during the Obama administration. But Mr. Trump has not vigorously supported the policy, and even Mr. Mattis said the “jury is out” on whether women should be put into combat roles.“This is a policy that I inherited, and so far the cadre is so small, we have no data on it,” Mr. Mattis said in remarks to officer candidates at the Virginia Military Institute in September.Ronald Reagan appointed Mr. Webb first as an assistant secretary of defense and, in 1987, as secretary of the Navy, where he pushed for modernizing the fleet and opening more jobs for women in the service. Between his stints in government, Mr. Webb continued his writing career, which includes the critically acclaimed Vietnam War novel “Fields of Fire.” He switched parties and in 2006 ran for the Senate as a Democrat; there, he helped pass the post-9/11 G.I. Bill and oversaw Asia-Pacific issues on the Foreign Relations Committee.Other names that have surfaced as potential replacements for Mr. Mattis have included a former Republican senator, Jim Talent of Missouri, and two current ones, Tom Cotton of Arkansas and Lindsey Graham of South Carolina. David H. Petraeus, the retired Army general and former C.I.A. director, was considered for the post earlier in the Trump administration but recently told the BBC that he “cannot envision returning to government at this time.”Last week, Mr. Trump said Mr. Shanahan might remain as acting secretary “for a long time.”On Wednesday, his second day as Pentagon chief, Mr. Shanahan voiced a tougher stand against China, telling the military’s civilian leaders to focus more on the country, according to a Defense Department official.