Skip to content

Commit

Permalink
Add baseline Linux VM config settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
nuket committed Jan 20, 2014
1 parent a0e3fa6 commit b67a6ed
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions config-linux-vm.sh
@@ -0,0 +1,55 @@
#!/bin/bash

while getopts ":v:P:" opt; do
case $opt in
v)
echo "Modifying VM: ${OPTARG}"
VM_NAME="${OPTARG}"
;;
P)
echo "Setting VDRE port."
VRDE_PORT="${OPTARG}"
;;
esac
done

basicConfig () {
VBoxManage modifyvm "${VM_NAME}" --memory 384 --acpi on --ioapic on --rtcuseutc on --accelerate2dvideo on
VBoxManage modifyvm "${VM_NAME}" --bioslogofadein off --bioslogofadeout off --bioslogodisplaytime 250
VBoxManage modifyvm "${VM_NAME}" --keyboard ps2 --mouse ps2
VBoxManage modifyvm "${VM_NAME}" --audio none
VBoxManage modifyvm "${VM_NAME}" --usb off
VBoxManage modifyvm "${VM_NAME}" --nic1 nat
VBoxManage modifyvm "${VM_NAME}" --boot1 dvd
}

# If the RDP server is going to have no authentication
# then the rule is to only allow it to serve via localhost:port
#
# You can then use SSH tunnelling to connect safely.
nullAuth () {
VBoxManage modifyvm "${VM_NAME}" --vrde on
VBoxManage modifyvm "${VM_NAME}" --vrdeauthtype "null"
VBoxManage modifyvm "${VM_NAME}" --vrdeaddress "127.0.0.1"
VBoxManage modifyvm "${VM_NAME}" --vrdeport "${VRDE_PORT}"
VBoxManage modifyvm "${VM_NAME}" --vrdemulticon "on"

echo "You can now connect to the VM at localhost:${VRDE_PORT}."
}

usage () {
echo "Usage: "
echo ""
echo "$0 -v [virtual machine] -P [vdre port]"
echo ""
echo " Resets authentication to null, sets listening interface to"
echo " localhost, sets port to specified value. Useful for ssh-tunneling."
echo ""
}

if [ -n "${VM_NAME}" ] && [ ${VRDE_PORT} -ne 0 ]; then
basicConfig
nullAuth
else
usage
fi

0 comments on commit b67a6ed

Please sign in to comment.