Add executable permissions to file

Hi,

I have used chmod 111 xfusion*.sh to add executable permissions. I saw the file had execuatble permissions. still the task is marked as failed. can someone please look into this.

I have pretty much same problem:

What I did:
ssh tony@stapp01

$> cd /tmp
$> chmod +x xfusioncorp.sh
permission denied
$> sudo !!
password, success
$> ll
—x–x–x 1 root root 0 … xfustioncorp.sh
$> ./xfusioncorp.sh
permission denied
$> sudo ./xfusioncorp.sh
some echo message

Now, I suppose that task was not approved because regular user could not execute the script but task description did not mention who should be able to run this script. In such case natural assumption is that file owner should be able to execute it… and since the file owner was root I verified that root could execute.

What can I do to get the task that was not correctly checked/described approved?

You need to make the file also readable, because how can it be executed if it cannot be read first.

chmod +x is enough to run the script.

This is not true. Why do we then get errors please explain?
The interpreter needs to read the script in order to run it, and it cannot read it without also setting the read permissions.

Then the question itself is not correct. You can see below screenshot to execute the script only x permission is enough.

Or you should have mentioned explicitly that any user should be able to execute it.

image

1 Like

File was owned by root and root was able to execute. Task does not mention users that do not own the file should be able to execute it. Period.

Hello,

Thank you all for reporting this. Since its a bash script not a normal file so it is asked to give it executable permission so that server users can run the script later whenever needed.

Please note that in case of bash script bash is the interpreter that is actually going to execute the script and the interpreter needs to read the script so even if you have given it only executable permission the interpreter i.e bash will not be able to execute it so you had to give it read permission as well along with execute permission.

But we can see how its bit confusing since there is no mention about the users who should be able to execute it, so we have modified the question a little, We hope it is more clear now.

At now I failed this task. The wording of the task has not been changed yet.