This is something I wrote in 2002. I wrote it mostly because of a shamefully late reading of Lord Of The Rings, but at least I did it before the movie!
Later that year, I read Cryptonomicon, and I found out Neal Stephenson completely disagrees with me. Which probably means you should listen to Neal Stephenson's theory that hackers are dwarves.
However, just because I am a shameless nerd, here is, in all it's geekitude, my essay about hacking and Lord Of The Rings, rescued from its deserved obscurity for a few minutes, with some extra footnotes.
You can read the spanish version, too.
This is a first draft, it will probably change a lot in the next few days/weeks/years 
The idea I want to examine is the connection between what a system administrator or programmer ( from now on "hacker" ) experiences and literature about magic and sorcery, and try to figure out if there lies the cause of the fascination hackers often feel for such books/movies/games.
The obvious paralellism; there is a direct correlation between knowing what this does:
du -s `grep $USER /etc/passwd | cut -d: -f6`
and knowing that if you intone certain words in a certain manner at midnight with a full moon your enemies will turn into hairy frogs 
The obvious flaw in that paralellism is that the hacker version works.
Of course I obviate some details, like the total lack of a supernatural ingredient on a hackish incantation, but that's not an issue here.
Any sufficiently advanced technology is indistinguishable from magic, right? That Arthur Clarke quote is usually applied in futuristic contexts to explain the use of things like nanotechnology in the replication at a distance of human beings.
But a more earthly use is that for 99.99% of the people, our current technology is
undistinguishable from magic already. That
du -s `grep $$USER /etc/passwd | cut -d: -f6`
gives a number that has a specific meaning is, literally, magic.
I think that's so, because most people are used to think that way all the time. For most, the world runs on magic.
How else can the average person describe a word processor? Or a fax machine?
What word, other than magic, can describe their blind faith that a phenomenon they don't understand will happen every time it's necessary so that an object they don't understand will perform the function they dictate?
The difference between believing in the fax and believing on the healing through faith is simply the reliability of the fax.
Therefore, if we consider magic to be a natural mechanism, self-consistent, to which we have access, but many don't understand due to ignorance of the process, the difference between magic and hacking disappear.
So, we have two objects to compare:
Hacking in real life
Magic in The Lord Of The Rings
My theory is that internally, every hacker identifies with a character, which makes him like the book.
Gandalf is a powerful wizard. He seems to have had to work to have his magic. He is wise. He is a very weird person.
I suspect Gandalf appeals to some hacker ideal. Hackers expect that when they grow older (say, about my age), their experience will allow them to watch things from an olympic height, and help the peasants only when they get in real trouble, and avoid the daily toil.
Gandalf is a managing hacker. Maybe a consultant.
Elves possess vast amounts of magic skill, but I don't think this is conscious on their part, but it's just how elves are. Doesn't Galadriel say she doesn; t know what magic is?
I expect that when Galadriel bakes lembas, she is making biscuits using her granny's recipe. If I do that, I get biscuits. She gets lembas because she's a frigging elf-queen.
Elves appeal to the hacker that believes he has an innate gift, those who believe the world is divided into hackers and non-hackers and the border is very hard to cross.
So, if your favourite character is an elf, you are probably an annoying elitist. You probably using numbers instead of letters, and arbitrarily try to use k and x instead of other letters because it makes the words look cooler.
However, you will probably get over it. As soon as you screw up enough times, you will become more humble. So, this category probably includes elitists and kids.
They are a peculiar breed. Chubby. Hairy feet. Like to eat. Sleep a lot. If Gandalf appeals to what hackers hope to be, Hobbits appeal to what many of the hackers I know actually are.
Let's be honest: being a hacker implies you are rather sedentary, at least partly.
I always say a good hacker has to be lazy (of course Larry Wall said it first). You do a little work so you don; t do a lot of work later.
The hairy feet are genetic.
Although I don't recall any mentions of great hobbit spells, there is one about the Shire being protected by a powerful magic.
I think it's just that because they are the way they are, they have the power to keep the place nice, neat and organized.
How else can you describe a good hacker? For my taste, a good hacker stays in his lair (although usually they don; t have round doors) minding his own business, and you don't need to call him because he already, by being how he is, kept things nice, neat, and clean.
Nice, relaxed people.
People that keeps the shire pretty without running around, at ease in their office, having three breakfasts a day.
Back in 2006
As you can see, I didn't say a single thing about dwarves. Neal Stephenson's theory is that hackers are like dwarves because they work in the darkness of their caves producing dazzling goods that are rarely appreciated by the other races.