There are many (in my opinion) strange additions in the Lord of the Rings movies that weren't in the book. One I'm having trouble understanding is when Aragorn, Legolas, and Gimli get attacked by the oathbreakers at the Stone of Erech. These ghosts have been waiting to be released for thousands of years, so why would Peter Jackson and company have them try to kill the one person who could release them from their misery? In the book, they were eager to fufill their oath. Is there an explanation in the behind the scenes footage in the extended editions other than just "we wanted to add suspense?"
Ok, the part about they're 'trying to kill the one person who could release them from their misery' was technically not true.
"The dead do not suffer the living to pass."
"You will suffer me."
"The way is shut. It was made by those who are dead. And the dead keep it." "The way is shut. Now you must die."
"I summon you to fulfil your oath!"
"None but the king of Gondor may command me!"
So you see, they didn't know that Aragorn was Isildur's heir and the only one who could release them yet. They thought he was just some random guy who wanted to pass through and, like they do for anyone else who tries to enter, they want to kill him.
It's only after Aragorn proves that he is the heir of Elendil and Isildur with Anduril (previously Narsil, the only weapon that could affect the ghosts) and with his words that they agree to fight.
The difference between the movie and the book is that in the book, Aragorn already displays the standard Arwen made for him, brought by Halbarad, so such a challenge and scene as shown in the movie would be unnecessary. The standard already displays the tree and stars of the kings of Gondor, but in the movie, he had to prove he was the heir first, so Anduril being able to affect the ghosts was very significant.
Although the ghosts did not attack any member of the group, the feeling JRR Tolkien relays through Gimli's point of view clearly shows the ghosts have no love for living trespassers.
Would Aragorn not have made the claim of his birthright and his "rendez-vous" call to the summoning stone, they could have died by insanity or other means (as seen for the remaining skeleton of an old Rohirrim king that sought gold and glory).
It is unclear if the ghosts in the book sensed anything about Aragorn's lineage, but they certainly responded to his summoning words. More likely, Peter Jackson wanted something more "dynamic" than a simple ride through the tunnels and meadows.