Over the next few months, the crew battled scurvy when their vegetables ran out, endured frequent mock executions and occasional beatings from guards when the Chinese, Taiwanese and Filipino crew didn't understand orders in Somali and broken English.
The pirates also forced crew members to call home, in hopes the families would pressure the ship's owners to pay the ransom. Lin listened to his wife weep for her son and husband.
Eventually, Lin explained through a translator, the ship's owners paid up last month -- the pirates had demanded US$1.5 million, but Lin refused to say how much was paid.
Everyone thought they were going home, but the pirates held out for more money. That's when the Americans got involved.
The US Navy said its personnel spoke with the pirates by radio, pressing them to leave.
They did so on Nov. 5, by skiffs that took them to shore. Then a US Navy vessel escorted Lin's ship out of Somali waters and provided its crew food and medical assistance.
Lin, who speaks no English, was unclear on who had helped, saying he believed "UN" forces as well as the US military was in the area because of the pirate activity.
US officials won't say exactly what they said to persuade the pirates to leave. But earlier, a US vessel had fired on pirate skiffs tied to a Japanese-owned ship.
At one point in recent months, at least seven ships were being held. Now, following US intervention, only two remain in pirate hands.
US Navy spokeswoman Lydia Robertson said: "Since we were there when the ships were pirated it was an opportunity for us to stay there and help free the ships."
Indonesia remains the world's worst piracy hotspot, with 37 attacks in the first nine months of this year, the International Maritime Bureau said.
Pirate activity is on the rise, with the biggest increases off Africa, and particularly Somalia.
On Wednesday, the crew of the Ching Fong Hwa 168 tucked into lobsters and chicken at the Chinatown restaurant in downtown Mombasa.
Their ship was safely in port, their families had been informed, and the men were enjoying their first taste of freedom -- and sake -- in over half a year.
"To freedom," toasted one man in Bermuda shorts and cheap plastic flip flops.
Another replied, "To home."