Linux permission denied after chmod a=rwx

37,746

Solution 1

I just noticed the error message references the name of the directory hosting your file:

eval: 1: /home/user1/MyApp/bin/wrapper: Permission denied

We know it's a directory since you mentioned "The directory MyApp/bin/wrapper contains 2 files".

Could you check your script for instance where you're using the name of the directory as a command? Such as using wrapper (which is the directory name) instead of wrapper/wrapper-linux-x86-32 (which would be a file name), or similar errors?

Similar errors often appear when using spaces in filenames and forgetting to quote said filenames (probably not the case here, though.)

Failing that, could you edit your question to include the contents of the wrapper script you're calling?

(New answer since it's completely unrelated to the previous noexec idea, and that one can stay for reference.)

Solution 2

The file system hosting your script might be mounted with the noexec flag. Check your /etc/fstab entry for that file system and if there's a noexec there try removing it then remounting that file system via mount /path/to/mountpoint -o remount

On second thought, check the output of the mount command for noexec instances instead of /etc/fstab (the file system might have been mounted dynamically.)

Share:
37,746
Lancelot
Author by

Lancelot

Software Engineer with experience in Node.js, C#, Java

Updated on July 09, 2022

Comments

  • Lancelot
    Lancelot almost 2 years

    So I have a little Linux problem, geez that will teach me to spend so many years on Windows. Anyway I did a little java app, wrapped nicely with the Java Service Wrapper script, but when I run that script:

    sh ./wrapper.sh console
    

    I get permission denied right away. The permission denied message is like that:

    eval: 1: /home/user1/MyApp/bin/wrapper: Permission denied
    

    My little wrapper.sh lives in the MyApp/bin folder. The directory MyApp/bin/wrapper contains 2 files:

    • wrapper-linux-x86-32
    • wrapper-linux-x86-64

    As a test I ran the following chmod command:

    chmod a=rwx MyApp -R
    

    I verified that everything was rwx, even in the sub-folders and tried to run the script again, with the exact same result... permission denied.

    Anyone has any idea of what I could try next to make that baby run?

    Thanks, Lancelot

  • Lancelot
    Lancelot about 15 years
    Hi Zifre, the #!/bin/sh is there I just checked.
  • Lancelot
    Lancelot about 15 years
    Hi Roy, when I do ls -Al here is what it prints for my wrapper.sh: -rwxrwxrwx 1 user1 user1 19035 2009-04-07 15:32 wrapper.sh
  • Lancelot
    Lancelot about 15 years
    no there is no "noexec" option on any of the file systems. But thanks for pointing out that file, it's useful to know where that info is.
  • Lancelot
    Lancelot about 15 years
    This is a very straight forward install of Ubuntu. Nothing is mounted after startup. The disk drives and the cdrom are mounted automatically when the system boots up.
  • Lancelot
    Lancelot about 15 years
    You da man. That's exactly what was happening. The system was confused and tried to execute a folder instead of a file. Note that if my structure had been bullet proof in the first place the system wouldn't be confused. Machines do only what we tell them to do! Thanks a million times moocha.
  • paxdiablo
    paxdiablo about 15 years
    chmod with = is quite acceptable, it's already set execute bit.
  • Mihai Limbășan
    Mihai Limbășan about 15 years
    Don't mention it, glad to be able to help.