They also blocked the Damaturu-Maiduguri road and killed travellers.
At the end of the attack, 78 persons lay dead, while several others were still missing.
According to members of the community, soldiers arrived the scene two hours after the gunmen had left.
The gunmen were said to be wearing military camouflage with black bandanas round their heads.
An official of DamaturuSpecialistHospital, who requested anonymity, said “immediately after the attack, 40 bodies were brought to the morgue and all are believed to have been students of the College of Agriculture in Gujba.”
The number, however, increased as more bodies were recovered from the bush.
Military spokesman, Lazarus Eli told newsmen that security forces were at the scene, but that details on the number of dead and injured were not yet available.
He added that the early morning assault was targeted at the College of Agriculture in Gujba, YobeState.
“It was carried out by Boko Haram terrorists, who went into the school and opened fire on students while they were sleeping,” he added.
A police source, who requested anonymity, said that initial reports indicated the death toll could be higher, but he was not prepared to discuss figures.
Provost of the College, Molima Idi Mato, said: “They attacked our students while they were sleeping in their hostels. They opened fire at them.”