esxidown icon indicating copy to clipboard operation
esxidown copied to clipboard

"Operation not permitted"

Open oliv-j opened this issue 2 years ago • 2 comments

New versions of ESXI do not allow root to run scripts from the datastore. Even after making executable this will result in "Operation not permitted" when you attempt to call either of the scripts (locally or remotely via ssh).

If you add the scripts to a new root level folder e.g. "/tools" and make them executable they can be run, but of course this folder and files will not be there after a reboot.

I did try to use the start up script /etc/rc.local.d/local.sh to recreate the directory and copy the files from the data store but this did not appear to run - the folder was not there after a reboot.

Is there a persistent file location that is not on a datastore where the scripts can be kept and where root can run them?

VMware ESXi 8.0.0 build-20513097 VMware ESXi 8.0 GA

oliv-j avatar Mar 05 '23 09:03 oliv-j

That's interesting, thank you very much for the report! I do not have an ESXi 8 machine atm, but will setup one for testing soon.

ThisIsTenou avatar Mar 05 '23 21:03 ThisIsTenou

Thanks for your reply. I did some more digging and found that I if I copy the files from the datastore into a folder off the root then I can call the script successfully. So, I put all those steps together into a single ssh call where the last call is to run the script:

ssh root@ipaddress "mkdir /tools; cp /vmfs/volumes/fatty/async.sh /tools/; cp /vmfs/volumes/fatty/esxidown.sh /tools/ ; chmod u+x /tools/*; /tools/async.sh"

Broken down, this:

  • creates a new root folder called 'tools'
  • copies the async file from the data store to /tools
  • copies the esxidown file from the data store to /tools
  • makes the files executable
  • calls the async.sh script

Must be run as root (which I think it did anyway), but this works like a charm and once set up has no difference in use, as long as the datastore remains available, but then it did anyway.

oliv-j avatar Mar 06 '23 08:03 oliv-j