2

I am running Debian testing and I am not able to run any binary or shell script. I keep getting "No such file or directory" for binaries and "Permission denied" for executable shell scripts. The umask is the default one and I haven't fooled around with the paths. Also, I am aware of this question, but it doesn't work out for me - I compiled my code on this machine and trying to run it on the same machine. Also, all of my shell scripts have the correct shebang.

Any advices?

Edit: I am not running any Armor or SELinux kind of application.

14
  • Can you add a little more information? Long-list the directory? Long-list your scripts? Example of scripts being executed? Full output from the command-line when you execute a script?
    – bedwyr
    Apr 26, 2010 at 20:17
  • Do the common system commands work (like ls, cd or mv)?
    – dag729
    Apr 26, 2010 at 20:17
  • @dag729: yes, they do Apr 26, 2010 at 20:19
  • 8
    Check to see if the filesystem you're on is mounted with the noexec option. Also, copy paste a session from your terminal into the question here, so people don't have to ask all kinds of question. Or even take a screenshot of your terminal...
    – nos
    Apr 26, 2010 at 20:42
  • 3
    Ok, replaced the fstab entries with default and now it's working. Thanks, nos, if you're adding the comment as an answer I can give you credit for it. Apr 26, 2010 at 20:56

2 Answers 2

1

More information including copy/paste of a terminal session would be helpful. But things to look for right away are that the binaries and scripts have the correct permissions (usually mode 0755). Double check that the shebang line in your scripts points to a valid binary. Run the "file" command on a binary to make sure it is a true binary for your architecture. Surely not all of your binaries get "no such file or directory", otherwise you wouldn't have been able to compile your code. Try the "which" command to see if your shell can find the binary you're trying to run (e.g. "which date" to see which command would run if you typed "date") and to make sure it is finding the one you think you're trying to run (sometimes a command appears earlier in your PATH and you're not aware of it).

1
  • Oops, I see you already found the problem and it was apparently due to incorrect mount options on the filesystem. Glad you found the problem. Apr 26, 2010 at 21:18
0

For binary files, it is a problem with the file or with the shell. Try running it on sh or with tcsh or re-downloading/re-installing it (if you made that yourself, you can try to recompile it). bash itself is a binary and if you can access to the shell, you can access to binary files, and the problem is in the file and/or in the shell.

For shell scripts, if the error is "Permission denied", I'd add the execution privilege using chmod a+x filename. The execution privilege is a form of protection given by UNIX systems. You can't run scripts or binaries without this privilege.

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.