I was in the process of installing Virtualbox day before yesterday (September 20, 2011); needed to add myself to the vboxusers group, but accidentally erased my group membership on Ubuntu –I feel retarded right now. It was a silly mistake really, I accidentally left out the “-a” (append) switch when I was trying to add myself to the vboxusers group.
A tail on /var/log/syslog file was not very helpful.
I feel sheepish 🙁
phiri@phrlig001:~$ groups phiri phiri : admin vboxusers
After a couple of minutes looking around on the Web, I came across this article on StackExchange.
root@phrlig001:/var/log# cat /var/backups/group.bak | grep ":phiri" root:x:0:phiri adm:x:4:phiri dip:x:30:phiri netdev:x:110:phiri lpadmin:x:111:phiri admin:x:119:phiri sambashare:x:122:phiri tomcat6:x:125:phiri
A simple loop through the backup file did the trick 🙂
root@phrlig001:/var/log# for groupname in `sudo grep ":phiri" /etc/group- | awk -F ":" '{print $1}'`; do usermod -a -G $groupname phiri; done
It worked 😀
root@phrlig001:/var/log# groups phiri phiri : admin root adm dip netdev lpadmin sambashare tomcat6 vboxusers