I am working on CentOS 6.5. The version of my glibc is 2.14, and I accidentally link /lib64/libc.so.6 to a previous glibc(libc-2.12.so).
Then I run export LD_PRELOAD=/lib64/libc-2.14.so, most commands can be executed except su and sudo. When run su, it gives "Segmentation fault". When run sudo, it gives "su: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /lib64/libcrypt.so.1)".
How to set LD_PRELOAD for su and sudo, or what can I do to recover the glibc?
There is no way, by design. Setting LD_PRELOAD allows arbitrary code to be executed within the executable. It would be rather unwise to allow that while running a sensitive prvileged SUID program.