bash script fails with 'Permission denied' error due to IMA policy.
Issue
- A bash script fails to execute with a
Permission deniederror, despite having the necessary permissions.- The issue specifically happens after loading IMA policy
appraise func=BPRM_CHECK appraise_type=imasig - Or executing
ima-setup --policy=/usr/share/ima/policies/01-appraise-executable-and-lib-signaturescommand.
- The issue specifically happens after loading IMA policy
- Example:
# ls -lZ sleep.sh
-rwxr-xr-x. 1 root root unconfined_u:object_r:admin_home_t:s0 20 Jul 6 22:57 sleep.sh
# cat sleep.sh
#!/bin/bash
sleep 2
# ./sleep.sh
-bash: ./sleep.sh: /bin/bash: bad interpreter: Permission denied
# cat sleep.sh
sleep 2
# ./sleep.sh
-bash: ./sleep.sh: Permission denied
Environment
- Red Hat Enterprise Linux 10
- Red Hat Enterprise Linux 9
- IMA (
Integrity Measurement Architecture)
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.