[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Safe removal of a user while purging



* Magnus Ekdahl 

| I'm trying to remove the clamav user when purging the clamav package. The 
| user clamav is created in postinst using:

Why are you removing that user?

| case "$1" in
| 	purge)
| 	TMPFILE=`tempfile`
| 	chown root:root $TMPFILE
| 	chmod 600 $TMPFILE
| 
| 	sed 's/clamav:!:[0-9]*:[0-9]*:[0-9]*:[0-9]*::://' /etc/shadow > $TMPFILE
| 	sed '/^$/d' $TMPFILE > /etc/shadow
| 
| 	sed 's/clamav:x:[0-9]*:[0-9]*::\/var:\/bin\/false//' /etc/passwd > $TMPFILE
| 	sed '/^$/d' $TMPFILE > /etc/passwd
| 
| 	rm $TMPFILE
|         ;;
|         remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
|         ;;
| 	*)
|         echo "postrm called with unknown argument \`$1'" >&2
|         exit 0
| esac

This will grant you a serious or grave bug.  Don't mess with
/etc/{passwd,shadow} directly -- that will break if people use
something like ldap for handling those files.

-- 
Tollef Fog Heen                                                        ,''`.
UNIX is user friendly, it's just picky about who its friends are      : :' :
                                                                      `. `' 
                                                                        `-  


-- 
To UNSUBSCRIBE, email to debian-mentors-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: