sudo vim /etc/default/virtualbox
then add:
VBOXAUTOSTART_DB=/etc/vbox
VBOXAUTOSTART_CONFIG=/etc/vbox/autostart.cfg
sudo vim /etc/vbox/autostart.cfg
then add:
default_policy = deny
kevin = {
allow = true
}
sudo chgrp vboxusers /etc/vbox
sudo chmod 1775 /etc/vbox
Then, for each allowed username:
sudo usermod -aG vboxusers USERNAME
Note: Log out and in for it to apply.
VBoxManage: error: Adding machine ‘Ubuntu-VM’ to the autostart database failed with VERR_ACCESS_DENIED
If you this error message, manually create<userid>.start
file under /etc/vbox
Run the on-time command VBoxManage setproperty autostartdbpath /etc/vbox
.
VBoxManage list vms
VBoxManage modifyvm <uuid|vmname> --autostart-enabled <on|off>
sudo service vboxautostart-service restart
or reboot the machine.
Post modified from Patrick Gaskin and Yakup