Remote execution error sh: line 1 Permission denied

Foreman throws this error when trying to start a job.

sh: line 1: /var/tmp/foreman-ssh-cmd-59b250c4-74c8-48e7-8f45-df5f60746f93/script: Permission denied

Exit status: 126

It suppose to run the job (ping google.com) and return an output.

Foreman and Proxy versions:
Foreman and Proxy plugin versions:

Forman 1.20.1
Foreman remote execution 1.6.7
Installed on CentOS 7.6

Can confirm it’s logging into the server - after that nothing is happening and it logs out:

Feb 10 04:49:42 testing sshd[31694]: Accepted publickey ssh2: RSA SHA256:

Feb 10 04:49:42 testing sshd[31694]: pam_unix(sshd:session): session opened for user root by (uid=0)

Feb 10 04:49:44 testing sshd[31694]: pam_unix(sshd:session): session closed for user root’

Hey,
exit code 126 means “command not executable”. What mount options do you have on /var/tmp?

Thanks for replying!

It’s just a folder - not mounted in any special way, I’ve tried various chmod permissions with no luck, currently it’s:

drwxrwxrwt. 5 root root 169 Feb 11 23:16 tmp

Then I would go towards the root from there. If /var/tmp or /var/ is mounted as noexec, my guess is it could manifest this way. Apart from this, maybe check for selinux denials? What happens when you try to run the script screated by remote execution on the remote machine by hand?

I’ve mounted /var/tmp now as a seperate drive, definitely not set to noexec. Still no fix.

The command I’m running is a simple ping:

ping -c 5 1.1.1.1

It works fine on the host.

Selinux is disabled so unlikely to have denials.