There are times when you need to remotely shutdown any running virtual machines on a linux-box. This is how to do it.

 

  1. Ssh to the host:
    # ssh sorin@lanfear

  2. Su to user running the vm:
    # su -

  3. List all vms:
    # vboxmanage list vms

    vm1
    vm2
    ...

  4. Shutdown vm1:
    # vboxmanage controlvm "vm1" poweroff

  5. Start vm2:
    # vboxmanage startvm "vm2" --type gui

    # vboxmanage startvm "vm2" --type headless