In my previous question, executed "chmod 666 ld-2.17.so" - how can i recover? I asked if I change
ld-2.17.so permission to read, how can I recover it back, since it won't allow me to execute anything at all that requires these libraries ?
And I got the answer as follows,
If you have an executable file you can write to, you could copy the contents of ld.so to that file using bash's read:
while IFS= read -d '' -r line; do printf "%s\0" "$line"; done > executable-file < /lib64/ld-2.17.so
I tried it, and it worked.
But what I am confused about is why this
while loop works if
/bin/bash itself requires
lib64/ld-2.17.so library, as can be seen as follows,
ldd /bin/bash linux-vdso.so.1 => (0x00007ffc54dee000) libtinfo.so.5 => /lib64/libtinfo.so.5 (0x00007f6fb9bbe000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f6fb99ba000) libc.so.6 => /lib64/libc.so.6 (0x00007f6fb95f6000) /lib64/ld-linux-x86-64.so.2 (0x000055ec142f5000)
Can someone please tell me why
bash code worked from terminal without the
Does that also mean that I can also create an empty executable file using
bash from terminal even if
/lib64/ld-2.17.so has no permissions?