Rattlesnakes are important members of the natural community. They will not attack, but if disturbed or cornered, they will defend themselves. Reasonable watchfulness should be sufficient to avoid snakebite. Give them distance and respect.
"Rattlesnakes are also among the most reasonable forms of dangerous wildlife: their first line of defense is to remain motionless; if you surprise them or cut off their retreat, they offer an audio warning; if you get too close, they head for cover. Venom is intended for prey so they're reluctant to bite, and 25 to 50 percent of all bites are dry - no venom is injected." Leslie Anthony. Snakebit: Confessions of a Herpetologist. Greystone Books, 2008.
Rattlesnake bites can be extremely dangerous, but rattlesnakes should not be considered as vicious and always ready to attack without provocation. They will not strike without a reason, but they will aggressively defend themselves. They are often portrayed with the body partly coiled, the tail rattling loudly, and the head up ready to strike. This display is a warning not to come any closer or they will strike; a defensive behavior that some rattlesnakes use when they sense that crawling away would put them in danger. If they are given some space and some time to escape to a safe place, they will usually crawl away as fast as possible.
Because they cannot crawl to safety as fast as some snakes, rattlesnakes often use their cryptic color and pattern to blend into their surroundings in order to hide from their prey and from other animals that could threaten them. They often hunt by sitting still and waiting for a warm-blooded prey animal to pass close enough for the snake to strike it. Sometimes a passing human will be struck instead, mistaken for food. When they sense the presence of something that might threaten them, rattlesnakes often lie still to avoid detection and do not rattle, because that would give away their location. At other times they rattle loudly, sometimes from a good distance, to warn potential enemies of their presence. In both cases they are doing everything they can to avoid confrontation and to avoid striking and biting and using up their valuable supply of venom which they need to kill and digest their food.
http://californiaherps.com/snakes/pages/c.o.helleri.html