CentOS /var mount point is usually with noexec attribute. This is annoying when executing scripts on that mount point, like Ambari scripts !
SO if you have these “permission denied” on executing a script, simply remount your mount point :
$ sudo mount -o remount,exec /var
Don’t forget to modify accordingly your /etc/fstab file so that modification will be permanent and not loose at each reboot.