On Wed, 10 May 2006, Chuck Noyes wrote:
Hi All,
I'm running ubuntu (brezzy), and I just shot myself in the foot....
I went to add my username to a new group, but forgot to include the other groups that I belong to in the command. The command I used was 'sudo usermod -G <new-group> <my-username>'. Now I only belong to <new-group>. That removed my username from the other groups I belonged to, including the admin group.
If its a personal system, I live dangerously, $ su # $EDITOR /etc/group :) But what really struck me was "Wow, what a horrible interface! You actually have to specify the full list of groups the user already belongs to, _plus_ the new group?!". Looking around my SuSE 9.x desktop at work, I found this (which does exactly what you were after), [sudo] groupmod -A <user> <group> On SuSE (9.x anyway) groupmod is part of the pwdutils package. But on gentoo, which I run everywhere else, groupmod is part of the shadow package, and it has a more limited set of options, _not_ including "-A". Although usermod in gentoo/shadow has a "-a" option to prevent it from deleting you from the other groups. Sigh... I'm sticking with $EDITOR. -Jamie