QuestionQ51

VerifiedSecurity and File Permissions

The current directory includes the following file:

-rw-r`"r`" 1 root exec 24551 Apr 2 12:36 test.sh  

The file contains a valid shell script, but running it with ./test.sh produces this error:

bash: ./test.sh: Permission denied  

What must be done to execute the script successfully?

Explanation

Direct execution of a script requires an execute permission bit on the file. The shown permissions do not grant execute permission, so the execute bit must be enabled, such as with chmod +x test.sh.

Community Discussion

No comments yet. Be the first to start the discussion!