A man who spent several days being terrorized by a grizzly bear in the Alaska wilderness was rescued thanks to an "SOS" he scrawled on the roof of a shack, authorities said.

The survivor, who wasn’t publicly identified, caught the attention of a Coast Guard helicopter flying from Kotzebue to Nome on Friday, the agency said in a statement.

COAST GUARD TRIES TO DISSUADE CUBANS CONSIDERING FLEEING COUNTRY BY BOAT

The crew spotted the "SOS" sign, and, while circling back, noticed the man waving his hands in the air, "which is considered an international distress signal," the Coast Guard said Tuesday.

The man had been staying in the hut on a remote mining camp about 40 miles from Nome.

He was attacked by a bear during his stay, and suffered bruising on his torso and an injury to his leg, the authorities said.

The beast returned to harass him every night for a week before he was rescued, the man said.

CLICK HERE TO GET THE FOX NEWS APP

He was taken to Nome for medical treatment.

To read more from the New York Post, click here.