3

From a cloud provider I received a RHEL 7 VM which has noexec set on /tmp.

[user@myserver]mount | grep /tmp
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noexec,seclabel)
/dev/mapper/SystemVG-var_tmp on /var/tmp type xfs (rw,relatime,seclabel,attr2,inode64,noquota)

I am installing a tool that won't work properly with noexec. This is a COTS tool that I cannot change. To remove noexec I can do

mount -o remount,exec /tmp

The problem is that after reboot /tmp is noexec again.

in /etc/fstab I have the following lines pertaining

/dev/mapp/SystemCG-tmp /tmp xfs defaults 0 0
tmpfs /dev/shm tmpfs defaults,nodev,nosuid,noexec 0 0

When I remove noexec from the line above this also does not seem to have any effect. After reboot the /tmp folder is still noexec.

How can I permanently remove noexec from /tmp?

1

1 Answer 1

1

To modify the mount options for /tmp, regardless of whether this is a good idea, you should look into /etc/cloud/cloud.cfg. Since you mentioned the machine is "from a cloud-provider", its likely the default mounts are being set on boot by the cloud-init process.

1
  • +1. Even if the filename /etc/cloud/cloud.cfg isn't the solution, I think the general idea here is on track. Some cloud providers will make alterations on each reboot. I've used chattr to positive effect to block such changes, but I heard that can also cause a machine to not boot in other configurations. You might need to just let /tmp/ get the undesired mount option automatically, but then automatically remove that mount option (run the mount command you specify) after the cloud provider tinkers but before the COTS software checks/cares.
    – TOOGAM
    Commented Oct 12, 2023 at 14:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .