#! /bin/sh #---------------------------------------------------------------------------- # remove-user-from-additional-group - remove user from additional group # # Copyright (c) 2003 Frank Meyer # # Creation: 20.07.2003 fm # Last Update: 20.07.2003 fm # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- clrhome colecho "Remove user from additional group" gn echo tty=`tty` echo echo echo -e "User: \c" read user IFS=':' if [ "$user" != "" ] then echo line=`grep "^$user:" /etc/passwd` if [ "$line" != "" ] then groups='' echo " Additional groups of user $user:" echo IFS=':' while read line do set -- $line g="$1" u="$4" IFS=',' set -- $u for j in $* do if [ $j = $user ] then echo " $g" groups="$groups "$g break fi done IFS=':' done /etc/group-$$ cp /etc/group /etc/group.old # save old group file cp /etc/group-$$ /etc/group # keep permissions rm -f /etc/group-$$ unset IFS else colecho "additional group $rg for user $user not found!" br x br fi else colecho "Command aborted" br x br fi else colecho "No additional group for $user found!" br x br fi echo else echo colecho "User $user does not exist!" br x br fi else echo colecho "Command aborted" br x br fi echo /var/install/bin/anykey