Hello,
I am doing “100 Day DevOps Challenge” I recently completed challenge no 4 (Day 4). I have completed task of “Providing executable rights to a file” I have also tested this by running the shell file but still I am getting “Failed”. Please look into it. You can see solution in the screenshot provided.
Thanks and Regards,
Bhargav Parmar
[email protected]
The following statement is mentioned in the question.
Additionally, ensure that all users have the capability to execute it.
You are almost correct but not quite, just making the file executable isn’t sufficient. You wouldn’t be able to run that script with a different user(other than root
, like banner
in this case).
Let me know if you were able to figure it out, if not I’ll explain what’s missing.
1 Like
Oh yes! You are right. Thank you so much. It was easy.
I am dealing with the same error. I dont understand what is wrong
It would helpful if you can share what you’d done exactly.
Assuming you have also done the same thing as @bhargav0605, i.e granting just the execution permission for the file.
Let’s say, someone has created a script and has given your user permission ONLY to execute it. Do you think you would be able to run the script, without being able to READ the file in the first place?
Not a compulsion, but @bhargav0605 or anyone in the community for that matter, it would be great if you could find some time to help others facing same issues that you’d once faced and resolved it. That way we will have a great community to learn from. I suppose you guys would have seen the following quote.
In learning you teach and in teaching you learn.
Happy Learning!! 
1 Like
I tried changing permission via
sudo chmod a+x <filename>
that seem to update the execute permission for owner, group and user
However, it did not help successfully executing the task.
I did some digging then tried updating permission via
sudo chmod 755 <filename>
which did the same as the previous command.
However, I am not sure what is the difference but this led me to successfully executing this task,
sudo chmod a+x <filename>
gives just the execute permission to user, group and others. It does not change read or write permissions.
With sudo chmod 755 <filename>
you are granting the following permissions -
User: read, write, execute(7: 111)
Group: read, -, execute(5: 101)
Others: read, -, execute(5: 101)
That being the difference between the two commands, we’ll try to understand why read permission is also required in this case.
The script file in the question has the following content
#!/bin/bash
echo "Welcome To KodeKloud"
The kernel reads the #!
line to find the interpreter (e.g., /bin/bash
).
Then it actually runs: /bin/bash myfile
Now /bin/bash
is a program that must open myfile
for reading — so read permission on myfile
is required for the script to run.
1 Like