John Tate wrote:
> Anyone got any ideas on a script that would disable or enable every
> user account in a given group, as in specify a group and every user in
> it would be effected?
>
cat > /sbin/disablegroup << EOF
#!/bin/bash
if [ "x$1" == "x" -o "x$2" == "x" ]; then
echo "Usage: `basename $0` [-l|-u] [group]"
fi
for user in `awk -F: '
$1=="'"$2"'"{
if($4) {
if(match(/,/, $4)) {
split($4, users, /,/);
for(user in users)
print user
} else
print $4
}
}
' /etc/group`; do
passwd $1 $user
done
EOF
this script that I just wipped together will lock/unlock all users
listed in /etc/group for the group specified.
it will not, however, disable users only attached to a group in
/etc/passwd. if you need that functionality, you should add it.
Cheers,
--
Morten
_______________________________________________
tsl-discuss mailing list
[email protected]
http://lists.trustix.org/mailman/listinfo/tsl-discuss