Till Maas wrote:
On Wed October 1 2008, Rahul Sundaram wrote:
> usermod -G wheel $USER
>
Maybe you want to add "-a" to add the group wheel, instead of replacing all
other groups.
Fair point. Along with Jarod Wilson's suggestion as well. How
about the
following?
-----------------
# check for the first user and add it to user wheel and then to sudoers
USER=$( grep 500 /etc/passwd | cut -d: -f1 )
GROUPS=$( groups $USER )
if ! groups $USER | grep -q wheel ; then
usermod -a -G wheel $USER
sed -i 's/# %wheel ALL=(ALL) ALL/ %wheel ALL=(ALL) ALL/'
/etc/sudoers
fi
EOF
------------
Rahul