It's working perfectly fine. A directory is just another file that isn't an ELF file. $ echo 'hi there' > /tmp/lib/libc.so.6 $ LD_LIBRARY_PATH=/tmp/lib ls ls: error while loading shared libraries: /tmp/lib/libc.so.6: file too short