I agree with others here that laying down local roots as quickly as possible is important.... not only to avoid trouble, but because it is an important reason for doing site research in the first place!
NGOs will provide some cover, but your better bet is local scholars, perhaps at the school you are affiliated with.
Avoid walking about alone. Someone said this already but it is VERY important. Just having a friend nearby will stop everything from harrassment to worse.
Just to consider, also- if some of the places you wish toi go to are very dangerous, perhaps the thing to do is have your business arranged, every detail, before you go. I don't know what sort of research you will plan on doing once there, but I would strongly advise against going on site before you have all your interviews/letters of affiliation/etc set up. When you arrange your meetings at these sites, you can ask if someone might meet you outside the site to smooth things over. I spent some time at a refugee camp known for bouts of violence directed at foreign visitors- I simply had my plans laid out BEFORE I went (so I didn't appear rootless or aimless) and I had an acquaintance (who was raised in the camp) accompany me, thereby minimizing my risk.
As a rule- the more ties you have the the imm. area, the better. You want to make it locally risky for anyone to mess with you. The wedding ring works for this reason. I would, at all costs, avoid carrying weapons... many countries wouldn't allow it anyhow.