On Tue, Dec 14, 2010 at 12:31 PM, OpenBSD Geek <open...@e-solutions.re> wrote: > Hi, > > After posted many requests on how to remove user from a group, i choosed > to build my own script. > And it works very fine. > > if [ $1 ] & [ $2 ]; then > cp /etc/group /tmp > cat /tmp/group | grep ^$2 > /tmp/onlygroup > cat /tmp/group | grep -v ^$2 > /tmp/nogroup > cat /tmp/onlygroup | sed "s/$1//g" | \ > B B B B sed "s/ /,/g" | sed "s/,,/,/g" | sed "s/,$//g" > /tmp/newgroup > cat /tmp/newgroup >> /tmp/nogroup > cat /dev/null > /tmp/group > cat /tmp/nogroup >> /tmp/group > cp /tmp/group /etc > chmod 644 /etc/group > chown root /etc/group > chgrp wheel /etc/group > rm -f /tmp/*
very "secure" step when you have some temporary files from daemons running for your account ;-) > echo "Success." > else > echo "Remove user from a group" > echo "Use : sh duig user group" > fi > > Cheers, > > Wesley MOUEDINE ASSABY > www.mouedine.net