Side-door

The Secret door was a hidden entrance and exit to the Lonely Mountain. It was used by the dwarves, Thráin II, and Thrór to escape the mountain when Smaug attacked it and claimed the mountain and the treasure as his own; whoever tried to escape via the main gate was killed. The door was made to look as if it was part of the mountain itself, however it was smooth whereas the rest of the rocks were rigid.

The Key
The door could only be opened on Durin's Day, and with a key. This key stayed with Thráin II up until the point when he was captured in the dungeons of Dol Guldur. Gandalf found him imprisoned and Thráin gave him the key and the map to give to his son Thorin.

Durin's Day

 * main article: Durin's Day

The Runes on the map indicated "stand by the grey stone when the thrush knocks", then wait until the sun had lowered. When a "red ray of the sun escaped like a finger through a rent in the cloud", a flake of rock would split and the key hole would appear.