Maj-Gen Ahmed Mohammed escaped unhurt after soldiers shot at his car at the Maimalari barracks, the sources said.
The soldiers blamed him for the killing of their colleagues in an ambush by suspected Boko Haram militants.
Meanwhile, Nigeria’s president has ruled out freeing Boko Haram prisoners in exchange for the release of more than 200 kidnapped schoolgirls.
A government minister had earlier said authorities were ready to negotiate with Boko Haram, but President Goodluck Jonathan insisted on Wednesday that this was out of the question.
“He made it very clear that there will be no negotiation with Boko Haram that involves a swap of abducted schoolgirls for prisoners,” said British Africa Minister Mark Simmonds after meeting Mr Jonathan in the capital, Abuja, to discuss an international recue mission for the girls.
Their kidnapping in Borno state on 14 April has caused international outrage, and foreign teams of experts are in the country to assist the security forces in tracking them down.
Army spokesman Maj-Gen Chris Olukolade described the incident in Maiduguri, the capital of Borno state, as an internal matter and said there was no need for public concern.
But the shooting shows that morale within the army is low as it battles Boko Haram, says BBC Nigeria analyst Naziru Mikailu.
The Islamist group has stepped up its insurgency, despite a year of emergency rule in Borno and its neighbouring state of Adamawa and Yobe.
President Jonathan has asked parliament to extend the emergency for another six months.
According to sources who were inside the Maimalari barracks, the soldiers accused Maj-Gen Mohammed of putting their lives and the lives of their families at risk by failing to ensure that they were well-equipped to tackle Boko Haram.
They also alleged that the military top brass had failed to give them a promised special allowance for fighting on the front line, they told the BBC Hausa service.
The world is watching to see what Nigerian President Goodluck Jonathan will do next
Colleagues of the protesting soldiers were killed in an ambush while driving back on Tuesday from Chibok town, from where Boko Haram abducted the schoolgirls a month ago.
UK Prime Minster David Cameron has offered to send a spy plane to Nigeria to help in the hunt.
Meanwhile, residents of three villages in Borno repelled an attack by suspected Boko Haram fighters on Tuesday, an eyewitness told the BBC.
About 200 militants were killed during the fighting in the Kala-Balge district of Borno state, he said.
The witness, who asked not to be named because of security concerns, said the residents had formed a vigilante group.
Boko Haram, whose name means “Western education is forbidden” in the local Hausa language, is notorious for raiding towns and villages, burning homes, looting banks and police stations, and killing people.