#! /bin/sh #---------------------------------------------------------------------------- # invalidate-password - invalidate password of a user # # Copyright (c) 2003 Frank Meyer # # Creation: 15.08.2003 fm # Last Update: 15.08.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. #---------------------------------------------------------------------------- user=$1 if [ "$user" = "" ] then clrhome colecho "Invalidate password" gn echo echo interactive=true echo -e "User: \c" read user echo else interactive=false fi if [ "$user" != "" ] then grep "^$user:" /etc/passwd >/dev/null if [ $? = 0 ] then sed "s/^$user:[^:]*:/$user:"'!:/' /etc/shadow.$$ cp /etc/shadow.$$ /etc/shadow # keep permissions rm -f /etc/shadow.$$ if [ $interactive = true ] then echo "Command successful" fi else if [ $interactive = true ] then colecho "User $user does not exist!" br x br else echo "User $user does not exist!" >&2 fi fi else colecho "Command aborted" br x br fi if [ $interactive = true ] then echo /var/install/bin/anykey fi