#!/bin/sh
#
# nessus-rmuser
#
# Written by Renaud Deraison <deraison@cvs.nessus.org>
#
# This script is distributed under the Gnu General Public License (GPL)
#

prefix=/usr/local
exec_prefix=${prefix}
bindir=${exec_prefix}/bin
sbindir=${exec_prefix}/sbin
libexecdir=${exec_prefix}/libexec
datadir=${prefix}/share
sysconfdir=/etc
sharedstatedir=/var
localstatedir=/var
libdir=${exec_prefix}/lib
includedir=${prefix}/include
oldincludedir=/usr/include
infodir=/usr/local/info
mandir=/usr/local/man
is_cygwin=

nessusd=${exec_prefix}/sbin/nessusd
nessusd_users=/etc/nessus/nessusd.users

# check whether we have echo -n, depending
# on the current shell, used
case `echo -n` in
\-n)	Xn=   ; Xc='\c' ;;
*)	Xn=-n ; Xc=
esac

if [ -z "$is_cygwin" ];
then
 # make sure that we are root
 case `id` in uid=0*) ;; *)
    echo "only root should use nessus-rmuser"
    exit 1
 esac
fi


login=$1

test -z "$1" && {
echo $Xn "Login to remove : $Xc"
read login
}

test -z "$login" && {
	echo "No login entered"
	exit 1
	}

if [ -d "$localstatedir/nessus/users/$login" ];
then
 rm -rf "$localstatedir/nessus/users/$login"
 echo "user removed."
else
 echo "This user does not exist"
fi
