I second the "eep" technique. It works almost universally ... unless your fingers are smeared with yummy stuffÂ

If your rats start wanting to challenge you and act agressively towards your hand when you are not cornering them and they are not in pain, you can try and show them that you're the boss. Simply grab them in your hand (firmly so they can't wiggle out but don't squeeze them either) and gently place them on their back and hold them there.
They will struggle for a while and as soon as they stop or as soon as they eep, let them go. After that, the most common reaction is to lick your hand. Basically you're showing them that you are able to dominate them and that they should respect you. It's as simple as that. I find that most rats never need to be shown that, but with the odd male high strung on hormones, sometimes I have to remind him that I'm bigger and stronger than them.
Some rats are more cage defensive and in that case its always best to let them come out on their own terms. I think that its because they feel that they have nowhere to run ... most animals would rather flee than fight, but in a cage, they're stuck, thus, when scared, they have no choice but to try and stand their ground. Some rats (especially surrenders, rescues or pet shop rats) have also had unpleasant experiences in the past. If in the past whenever someone would open the cage they ended up being held by the tail or hurt or abused, its normal for them to be very cage defensive.
One thing that I find helps a lot is to set a limit. For me its the igloo. Unless the rat is in real danger and / or needs immediate assistance, I never attempt to grab them when they are inside. Anywhere else (hammock, litter box, pile of paper) is fair game, just never the igloo. It's their ultimate safe spot and they know that if they go there I will not disturb them. For me it works really well and the rats don't act defensive when I plop my hands or head or whole torso in the cage because they know that they can always retreat to their igloo.
And if he tried to bite you but didn't break the skin, he probably didn't intend to bite you for real. I've been bitten only twice by a sick rat who needed painfull injections and believe me, if they decide that they bite, their teeth go through your skin like butter.
