'Permission denied' to run /tmp/script_nnnn.sh on linux 2023

I’m using HashiCorp Packer to create an image for AWS. The process works fine with Amazon Linux 2, but I encounter a “Permission denied” error when using Amazon Linux 2023.

It appears that there is the stricter permissions on the folder “/tmp” directory in Amazon Linux 2023 that prevents running shell scripts.

Is there a way that I can tell packer to use “/var/tmp” instead of “/tmp” to run the shell script?

I appreciate for any guidance and assistance to resolve this issue.

Here is the detail of the log that mentioned “Permission denied”

=============================
==> Connected to SSH!
==> Provisioning with shell script: /tmp/packer-shell179473623
==> bash: line 1: /tmp/script_4178.sh: Permission denied
==> Provisioning step had errors: Running the cleanup provisioner, if present…
==> Terminating the source AWS instance…
==> Cleaning up any extra volumes…
==> No volumes to clean up, skipping
==> Deleting temporary security group…
==> Deleting temporary keypair…
Build ‘ami.amazon-ebs.this’ errored after 1 minute 41 seconds: Script exited with non-zero exit status: 126.Allowed exit codes are: [0]

==> Wait completed after 1 minute 41 seconds

==> Some builds didn’t complete successfully and had errors:
→ Script exited with non-zero exit status: 126.Allowed exit codes are: [0]

==> Builds finished but no artifacts were created.

=============================

Thank you for your assistance.