West Gate of Moria

When this was done they turned to watch Gandalf. He appeared to have done nothing. He was standing between the two trees gazing at the blank wall of the cliff, as if he would bore a hole into it with his eyes. Gimli was wandering about, tapping the stone here and there with his axe. Legolas was pressed against the rock, as if listening.
'Well, here we are and all ready,' said Merry; `but where are the Doors? I can't see any sign of them.'
'Dwarf-doors are not made to be seen when shut,' said Gimli. `They are invisible, and their own masters cannot find them or open them, if their secret is forgotten.'
'But this Door was not made to be a secret known only to Dwarves,' said Gandalf, coming suddenly to life and turning round. `Unless things are altogether changed, eyes that know what to look for may discover the signs.'
He walked forward to the wall. Right between the shadow of the trees there was a smooth space, and over this he passed his hands to and fro, muttering words under his breath. Then he stepped back.
'Look!' he said. `Can you see anything now?'
The Moon now shone upon the grey face of the rock; but they could see nothing else for a while. Then slowly on the surface, where the wizard's hands had passed, faint lines appeared, like slender veins of silver running in the stone. At first they were no more than pale gossamer-threads, so fine that they only twinkled fitfully where the Moon caught them, but steadily they grew broader and clearer, until their design could be guessed.
At the top, as high as Gandalf could reach, was an arch of interlacing letters in an Elvish character. Below, though the threads were in places blurred or broken, the outline could be seen of an anvil and a hammer surmounted by a crown with seven stars. Beneath these again were two trees, each bearing crescent moons. More clearly than all else there shone forth in the middle of the door a single star with many rays.
`There are the emblems of Durin!' cried Gimli.
`And there is the Tree of the High Elves!' said Legolas.
`And the Star of the House of Fëanor,' said Gandalf. `They are wrought of ithildin that mirrors only starlight and moonlight, and sleeps until it is touched by one who speaks words now long forgotten in Middle-earth. It is long since I heard them, and I thought deeply before I could recall them to my mind.'
...
`The words are in the elven-tongue of the West of Middle-earth in the Elder Days,' answered Gandalf. 'But they do not say anything of importance to us. They say only: The Doors of Durin, Lord of Moria. Speak, friend, and enter. And underneath small and faint is written: I, Narvi, made them. Celebrimbor of Hollin drew these signs.'
`What does it mean by speak, friend, and enter?' asked Merry.
'That is plain enough,' said Gimli. `If you are a friend, speak the password, and the doors will open, and you can enter.'
'Yes,' said Gandalf, 'these doors are probably governed by words. Some dwarf-gates will open only at special times, or for particular persons; and some have locks and keys that are still needed when all necessary times and words are known. These doors have no key. In the days of Durin they were not secret. They usually stood open and doorwards sat here. But if they were shut, any who knew the opening word could speak it and pass in. At least so it is recorded, is it not, Gimli? '
'It is,' said the dwarf. `But what the word was is not remembered. Narvi and his craft and all his kindred have vanished from the earth.'
...
`If you wish to know, I will tell you that these doors open outwards. From the inside you may thrust them open with your hands. From the outside nothing will move them save the spell of command. They cannot be forced inwards.'
...
Picking up his staff he stood before the rock and said in a clear voice: Mellon! The star shone out briefly and faded again. Then silently a great doorway was outlined, though not a crack or joint had been visible before. Slowly it divided in the middle and swung outwards inch by inch, until both doors lay back against the wall. Through the opening a shadowy stair could be seen climbing steeply up; but beyond the lower steps the darkness was deeper than the night. The Company stared in wonder.
`I was wrong after all,' said Gandalf, 'and Gimli too. Merry, of all people, was on the right track. The opening word was inscribed on the archway all the time! The translation should have been: Say "Friend" and enter. I had only to speak the Elvish word for friend and the doors opened.

(LoTR, II-4)