Actually, it's easier than it looks. They often attack ships from astern at night, using grappling hooks and ropes or hooks on poles to board the ship before anyone raises the alarm.
Those small pirate boats are fast, hard to see and even harder to detect by radar.
Even a very large ship such as a VLCC (Very Large Crude Carrier) or container ship will have a small crew, nowadays no more than 25 and often fewer. Of those, at any given moment, about one-third are asleep. The on duty crew would consist of the engineering officers, motorman and wipers who would be below deck in the engine room, unable to assist in anti-piracy patrols or ops. The galley crew would only be able to secure the galley and surrounding living quarters. On the bridge, there is often only one mate on watch and a seaman at the wheel. That leaves only a few people to handle the anti-piracy measures.
The ships will often be fully lit, and have their fire hose hooked up and shooting over the sides at likely boarding points. The crew patrols with two-way radios and flashlights. If a pirate vessel is spotted, the ship normally increases to max speed and tries evasive maneuvers (kinda hard in a 1000 foot long ship built for seas and cargo, not speed). The crew would attempt to repel boarders using fire hoses, searchlights, and sometimes acoustic sound devices. If pirates do board, the crew almost always surrenders without a fight (what's the use if the pirates have AK-47's and all you got are flare guns and maybe a pistol or two?).
Also, a fully loaded tanker has very little free-board as they ride low in the water. Cruise ships are also probably easy to board, but the potential for a hostage crisis and fatalities increases dramatically. (seafarers from the modern 3rd world seafaring countries don't want to be heroes. just make money. Also the passengers on a cruise ship might be a terrorist target)
Edit:
About the height: Have you ever seen that disgusting show "Fear Factor"? If people from middle class lives in America are willing to do those kinds of things for money, imagine what people from a poor, impoverished country without a government since 1991 would be willing to do for a chance at a part of the millions of dollars in ransom money. It's like the lottery, except you only have to shimmy up a rope, point a gun, and call up the shipping company with your demand. All of that while you're high outta your mind on khat (a leafy, plant that when chewed is an hallucinogenic and also like methamphetamine ) and just dreaming of what you're going to do with your share of the loot.
Also, the "ladder" is called a gangplank and it's supposed to be pulled up while the ship is at sea. If a ship didn't have a gangplank, how would the crew get on and off while in port? As well as all of those crooked and corrupt customs, immigration and other wonderful "officals"
Edit:
Also, a word about arming ships crews. Merchant Seaman are just that, not military personnel. They are not trained in weapons and the potential for a mistake are high, because in many of the same waters that pirates are found in, so are many more small boats including ones trying to get close to sell things to the ships crews (obviously not in the middle of the night, but in areas like the Suez canal and many ports), and small fishing vessels, which often fish with no lights (don't wanna get caught illegally fishing) and could also be mistaken for pirates. If ships crews were armed it would have two probable outcomes: 1. The pirates say "Aw shucks, I guess we're going to have to go home and try to find some other work (not likely in a country with no government, and most of the people are eating donated food aid) or they can do number 2: So you wanna play rough? Now we're just blow you away with our AK's RPG's and our NEW weapons bought with our millions in ransom money. Now it's going be blood money.
Source(s):
http://people.howstuffworks.com/pirate5.…
http://en.wikipedia.org/wiki/Piracy_in_S…
http://en.wikipedia.org/wiki/Khat