I downloaded my professor's "shell" program and am trying to run it on my machine to do some homework. When I tried to run it from terminal using ./shell I got a "Permission denied error". After running chmod 777 shell I tried runninging it again, only to get the "no such file or directory" error. I'm not sure why this is happening as I can still see the executable using ls. When I check the permissions of shell I get -rwxrwxrwx 1 ubuntu ubuntu 9403 Feb 16 03:45 shell so I'm not sure what the matter is. Can someone help me get this thing running?

Output of file ./shell:

./shell: ELF 32-bit LSB  executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped

Output of uname -a:

Linux ubuntu 3.19.0-25-generic #26~14.04.1-Ubuntu SMP Fri Jul 24 21:16:20 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
  • 1
    Perhaps you are on a 64-bit system and the executable is a 32-bit one? In that case you need to install additional packages in order to run it. – fkraiem Feb 16 '16 at 20:10
  • @fkraiem - shell scripts are not 32 or 64 bit. compiled binaries will (usually) give ELF errors. – Panther Feb 16 '16 at 20:11
  • @muru I edited the posting, it's at the bottom. – Adam Feb 16 '16 at 20:12
  • @bodhi.zazen This is not a shell script. And, no. – fkraiem Feb 16 '16 at 20:13
  • 1
    @Serg That's because the error for a missing ELF interpreter is the same as that for a missing file. See man 2 execve, look up ENOENT. So, if /lib/ld-linux.so can't handle 32-bit executables, that's the error you'll get. Adam, try installing gcc-multilib. – muru Feb 17 '16 at 2:13
chmod +x <name of shell script>

is something you need to do to execute this shell script. What are the contents of the shell scripts. May be the "no such file or directory" error is coming from some command/action within the shell script. Please share the contents of the shell script or execute them one by one (one at a time) to find out which one is causing "no such file or directory" error.

  • I was just given an executable, the professor wants us to implement something similar by ourselves and so hasn't give us the source code. – Adam Feb 16 '16 at 20:06

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.