apt-get install virtualbox
Start a vm with
VBoxManage startvm <vm>
Enter the following at Command::
VBoxManage controlvm <vm> acpipowerbutton
For this to work, you need to modify /etc/acpi/powerbtn-acpi-support.sh:
#!/bin/sh /sbin/shutdown -h -P now "Power button pressed"
Alternatively, set up SSH access to all virtual machines and send the shutdown command through SSH.
This explains how to share files and folders (directories) between host and guest. (Files are shared over a network, in other words, you access remote files. For virtual machines, the network between host and guest is virtual since they are on the same real machine. But the steps you take are similar to setting up file sharing over real networks.)
Before sharing folders, you must install the Guest Additions in the host, if they are not already installed.
# apt-get update # apt-get install virtualbox-guest-additions-iso
Make sure the iso image will get mounted with exec options. To do this, modify the default fstab entry for the cdrom and add exec after user.
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto,exec 0 0
Check how your file systems are mounted with
cat /proc/mounts
usermod -a -G vboxsf www-data
With a shared folder named share, the folder can be mounted as the directory ~/host with either of the following commands:
sudo mount -t vboxsf share ~/host # root only sudo mount -t vboxsf -o uid=$UID,gid=$(id -g) share ~/host # UID & root
On the Windows Guest, run
net use x: \\vboxsvr\share
Now anything placed in this folder should be visible from the host in the ~/share folder.
This can be done more generically with the following:
sharename="whatever.you.want.to.call.it"; sudo mkdir /mnt/$sharename sudo chmod 777 /mnt/$sharename sudo mount -t vboxsf -o uid=1000,gid=1000 $sharename /mnt/$sharename ln -s /mnt/$sharename $HOME/Desktop/$sharename