2

I recently installed a Debian Jessie amd64 headless server (using one of the netinstalls). The server is up and running and the system is working as expected.
But then I compiled a .cgi (written in C++). The compilation (using g++ 4.9.2) went well but as soon as I try to execute the file from bash it says No such file or directory.
As I read through other posts regarding this error I tried utilizing the file, ldd and even the cat command, but all of them say they can't find that file.
ls -l shows the file with 755 permission as expected.
But the bash-completion does nothing, it doesn't autocomplete the path.

But now it gets interesting:
Using midnight commander I can successfully read, edit and execute the binary and apache lists the complete directory index including the .cgi and would even let me download it.

What is going on?
Since I could execute it from mc I don't suppose it's about the executable itself.
Could the bash be corrupted?
Thanks in advance for any insights!

  • Are you using btrfs, by anyc hance? – MariusMatutiae Oct 6 '15 at 9:19
  • Sadly not, it's ext4. – Mäx Müller Oct 6 '15 at 9:27
  • What is the exact filename of the executable? – chaos Oct 6 '15 at 9:42
  • It's just index.cgi. No spaces or other hidden characters... – Mäx Müller Oct 6 '15 at 9:46
  • 1
    Goddamit! Instead of a normal i it got a î (with accent or whatever). Thanks man for pointing me in the right direction! If you post this as an answer I'll give you an accept! – Mäx Müller Oct 6 '15 at 12:01
0

You can search for that file in the directory and hexdump all filenames like this:

find . -exec sh -c 'echo -n "$1" | xxd' _ {} \;

It prints (for example):

0000000: 2e2f 696e 6465 782e 6367 69              ./index.cgi
0000000: 2e2f 696e 6465 782e 6367 690a            ./index.cgi.

The second line index.cgi has a newline at the end (0a). You can look how the name of the file is and compare it with the first line in my example output. If everything is correct, the filename should look exactly like in the first line.

0

Use updatedb command. This will going to update your directory database. Please see reference for more info updatedb Docs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.