Es ist sicher nicht perfekt, aber es funktioniert.
Viel Spass! Hoffe es hilft einigen.
Code: Alles auswählen
#!/bin/bash
#
#
EXPECTED_ARGS=1
E_BADARGS=65
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root or via sudo." 1>&2
exit 1
fi
if [ $# -ne $EXPECTED_ARGS ]
then
echo "Usage: `basename $0` username"
exit $E_BADARGS
fi
vbHOME=$HOME/
vbBACKUP="mountkernfs.old"
vbPATH=/etc/init.d/
vbFILE="mountkernfs.sh"
vbUID=`id -u $1`
vbOLD="domount usbfs usbdevfs /proc/bus/usb usbfs -onodev,noexec,nosuid"
vbNEW="domount usbfs usbdevfs /proc/bus/usb usbfs -onodev,noexec,nosuid,devgid=$vbUID,devmode=0664"
clear
echo -e "\nThis Script was only tested on Debian Lenny, but should work somewhere else too."
echo -e "\n\n\nRun this script only once, otherwise you destroy your mountkernfs!! \nWrite \"YES\" to continue...\n\n"
read
if [ "$REPLY" = "YES" ]; then
cp $vbPATH$vbFILE $vbHOME$vbBACKUP
sed -e "s!$vbOLD!$vbNEW!" $vbHOME$vbBACKUP > $vbPATH$vbFILE
else
exit 1
fi
clear
echo -e "Remember: Do not run this script again! \nDo you want to reboot now (YES/NO)?"
read
if [ "$REPLY" = "YES" ]; then
/sbin/shutdown -r now
else
exit 1
fi
Searchindex: virtualbox usb vbox