Best way to shutdown VM?
Author: kanav99Created Jan 13, 2021Updated Aug 3, 2021
I am writing a wrapper over xhyve in swift, where I have given setuid to the xhyve binary (!!) and run the Ubuntu VM on a button click. Now I want to shut down the VM. Options -
- Make a root user and set its ssh shell to
poweroff. But this can be exploited by any other applications. - Run
kill- nope, because I don't want to give setuid to a binary that can kill - SIGINT - Not graceful
- Simulating Ctrl + SysRq + o - how do I do this?
I want to do a safe shutdown - what should be the best way?
Source: machyve/xhyve