If you don't mind doing a bit of shell scripting, and you've found a script you can run from the Terminal that will switch to windows, you can create a script containing that command (and maybe a reboot
command following it). Let's call it winreboot.sh
for sake of argument. Then change the owner of that script to root
, mark it as executable and put it in a useful location (such as /usr/local/bin/
). If you run it like so:
sudo /usr/local/bin/winreboot.sh
It will ask you for the admin password, and then should do its thing, as the script then runs as root. However, sudo
maintains a list of rules on which users are allowed to run what commands using sudo
, and whether or not a password is required. This ruleset is stored in /etc/sudoers
- unfortunately the syntax is very confusing, which is why you're not supposed to edit the file directly, but should use
sudo visudo
instead, which checks your syntax on saving. Note that this uses vim for editing, which you might want to read up on before running it - it can be very confusing if you're not used to it. (to quit it without saving, press <ESC>
and type :q!
followed by the <ENTER>
key) If you can't get on with vim, edit a copy of sudoers with your favourite editor and check the syntax with visudo -f /path/to/sudoers-copy
. If it's OK, copy it back over the original.
Getting back to the point, the rule you want to add to sudoers is that you want users in the admin
group to be able to run your script as root without a password. That looks like this:
%admin localhost=(ALL) NOPASSWD: /usr/local/bin/winreboot.sh
Add it as the last line of sudoers. If you now try to run your script with sudo
(must do so with absolute path), it will NOT ask for a password and just run it instead. Wrap the sudo command in another shell script, link to it from the desktop or wherever, and your 6-year-old should be able to switch to Windows any time.
Hope that helps, let me know if anything is unclear.