/bin/sh: bad interpreter: Permission denied

The mentioned error occurrs when the /tmp is mounted with noexec permission. First step to ensure that the tmp is mounted with noexec permission is to check the /etc/fstab.

cat  /etc/fstab

/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
/dev/VolGroup00/LogVol04 /home                   ext3    defaults        1 2
proc                    /proc                   proc    defaults        0 0
sysfs                   /sys                    sysfs   defaults        0 0
/dev/VolGroup00/LogVol01 /tmp                    ext3 loop,noexec,nosuid,rw    defaults        1 2
/dev/VolGroup00/LogVol02 /usr                    ext3    defaults        1 2
/dev/VolGroup00/LogVol05 /var                    ext3    defaults        1 2
/dev/VolGroup00/LogVol03 swap                    swap    defaults        0 0
#/dev/tmppart           /tmp                     ext3 loop,noexec,nosuid,rw 0 0

If it is mounted with noexec permission, then our requirement to mount the same with execute permission.

Edit the /etc/fstab file. Remove the entry noexec from it.

Now the modified entry should look like,

/dev/VolGroup00/LogVol01 /tmp                    ext3 loop,nosuid,rw    defaults        1 2

Now we need to remount the partition

mount -o remount,exec /tmp


mount -o remount

This will mount the /tmp with exec permission.

Once the script execution is over, remount the /tmp back to noexec.

mount -o remount,noexec /tmp

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.