As a Marine infantry sergeant, James LaPorta once led an intelligence team in Afghanistan. Now, as a private citizen, he is doggedly tracking the moves of an online group that has been secretly compiling and sharing nude photos of hundreds of women in the Marine Corps.

With top generals admitting before Congress that they are unsure how to protect members of the Marine Corps from nameless, faceless social-media “predators,” Mr. LaPorta is among an unlikely scattering of can-do young veterans who have decided to take that assignment upon themselves.

He and his comrades in online vigilance have been gathering intelligence and making counterstrikes, tracking the members of illicit groups, including Marines United, as they try to hide, and stripping away the anonymity that has allowed the group to thrive. They are also feeding information back to Marine Corps investigators.

“The Marines’ response is to be careful and slow, but the people they are after move very fast,” Mr. LaPorta said. “If you want to catch them, you have to move at their speed.”

Indeed, Marine Corps leaders have resorted to traditional moves, commissioning a task force and mounting a meticulous investigation. But the commandant of the Marine Corps, Gen. Robert B. Neller, frankly admitted to the Senate Armed Services Committee on Tuesday that the nude-photo scandal was a cultural problem he was ill-prepared to address.

“There is a risk I cannot protect people on social media,” General Neller said.

It is certainly not easy: Marines United, which consists of thousands of active-duty and veteran Marines, has hopped from Facebook page to Facebook page, changing its name each time it gets shut down, while still trading illicit photos and taunting federal investigators.

“The Marine Corps thought because they shut a Facebook page down, the group was dead,” said Mr. LaPorta, 30, who left the Marines in 2014. “We had to show them it was just metastasizing into other back rooms.”

Mr. LaPorta and other veterans trying to fight groups like Marines United have been deluged with online harassment themselves. Other Marines have called them traitors and threatened them with violence, but they have pressed on in what they see as a battle for the future of the Corps.

“The Marine Corps can’t do this alone. The internet is too huge,” Mr. LaPorta said. “We need to police ourselves.”

They say the fight is up to them in part because trying to get Marine Corps leaders, who are often near retirement, to recognize and address the power of social media in the military is as slow and frustrating as teaching an aging parent to set up a new laptop.

“There is a disconnect between the upper echelon and a digital millennial generation,” said Thomas Brennan, 31, a former Marine sergeant who served in Iraq and Afghanistan and revealed the existence of Marines United this month.

Mr. Brennan said he was frustrated by what he saw as a slow and outdated response, as commanders convene a task force made up largely of older, high-ranking Marines and put out new social media policies that will be ignored or ridiculed online.

He added that the military’s response so far had been ineffective, noting that he had given investigators dozens of names and files on Marines United nearly two months ago but was not aware of the authorities’ having taken any action.

“I almost feel like they didn’t want to admit this stuff existed,” Mr. Brennan said. “And when we forced them to, they were caught off guard.”

A Marine Corps spokesman said he could not comment on the ongoing investigation.

Earlier this week, Representative Jackie Speier, Democrat of California, announced that investigators had identified 700 active-duty Marines and 150 Marines in the Reserve who were involved in the Marines United group.

For several years, the Marine Corps has known of web pages where Marines shared racist and sexist memes, as well as photos of female Marines posted without their consent. Despite a number of public reports, the Corps has failed to crack down on the sites.

For several years, active-duty and veteran Marines in a group called Just the Tip of the Spear have been posting illegal and offensive material on Facebook, Instagram and other sites. Like Marines United, they have posted nude photos of servicewomen without their permission. In some cases, they have also posted the women’s telephone numbers and other private information. When women complained, the site’s followers often harassed them more.

Shawn Wylde, a Marine captain who served in a mixed-gender support battalion in Iraq, reported the site to Marine law enforcement as soon as he saw what was happening in 2013.

“I got nothing, not even a call back,” said Mr. Wylde, 36, who was discharged in 2012 and has since built an online T-shirt company that does $8 million in annual sales. “I got angry that the Marine Corps was doing nothing.”

Mr. Wylde runs a Marines Facebook page called Silkies, named after the ubiquitous green Marine Corps workout shorts: a page he uses, in part, to steer business to his company. He has become, by his own description, “pretty good at online marketing,” which gave him a fresh idea for how to tackle the problem.

When news emerged this month that the Marines were still engaged in the same type of online harassment, Mr. Wylde decided to fight Just the Tip of the Spear on his own by tracking down the anonymous members and unmasking them one by one by posting their names on the Silkies Facebook page.

With $10,000 of his own money, he bought targeted ads on Facebook on Monday to appear on the pages of young Marines, especially young female Marines. The ads featured a meme of Defense Secretary Jim Mattis denouncing the shadowy groups and asking everyone to send information on the anonymous ringleaders to Mr. Wylde, so he could out them.

“It’s clear the leadership doesn’t understand how social media works,” Mr. Wylde said. “But I do, so I figured I had to do something.”

Mr. Wylde is an unlikely crusader for decency. In 2013, he pleaded guilty to defrauding the government of nearly $100,000 in unearned housing and veterans benefits, and served four months in a federal prison.

But he said he was newly motivated by the disrespect the groups continued to show toward women in the Marines.

“I served with a lot of great women in Iraq. One was actually killed by an I.E.D.,” he said, referring to an improvised explosive device. “These guys harassed a woman who was a friend of mine. I wanted it to end, and it didn’t look like anyone was going to do anything.”

He added: “The main point here is to make a cultural change, not get them prosecuted. That would be great, though.”

Within hours, Mr. Wylde said, his ads began bringing in tips. Several women wrote in with information on men who they said were running Just the Tip of the Spear. Two of the tipsters claimed to be the wives of key members of the group.

Some of the men are still active Marines. One of the founders of Just the Tip of the Spear was named Marine of the Year by The Marine Corps Times, according to Mr. Wylde. He has given the men’s names to the Marine Corps but said the Corps had not responded.

The New York Times tried to contact several of the men named, but none replied.

Some female veterans close to the men said that some were veterans who spent most of their time online and had been unable to transition from their military life.

Since Mr. Wylde began his efforts on Monday, many of the Marines he has accused have shut down their social media accounts. The group has also lost at least two corporate partnerships. And one of the founders, apparently unnerved and unaccustomed to public scrutiny, has publicly challenged Mr. Wylde to a fight.

All week, as Mr. Wylde has continued his crusade against anonymous trolls, his Silkies site has been flooded with messages of support, many of them from women who were targets of the group.

“You are single-handedly restoring my faith in my brothers,” one female Marine veteran wrote. “I’ve seen so many of those troll pages, I was starting to believe maybe that’s what our brothers really thought of us.”