Skip to content

Startup Script Gets Permission Denied When SELinux is Enforcing and Filesystem is NOEXEC #525

@rcuza

Description

@rcuza

On a RHEL-9 GCP compute VM, the google_metadata_script_runner places the startup script in a /tmp/metadata-script${suffix}/ folder and adds the execution bit to the file. By default, one cannot execute a script from /tmp when SELinux is enforcing.

The permission denied error can be reproduced by trying to execute a script in /tmp while SELinux is enforcing.

Possible solutions:

  • do not use TmpDir when SELinux is enforcing
  • explicitly set the SELinux context for the startup script
  • use a location that SELinux blesses (eg Red Hat uses /usr/local/sbin/custom-firet-boot for their first boot script)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions