Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Aug 1995 13:12:35 -0700 (PDT)
From:      Wes Santee <wsantee@wsantee.oz.net>
To:        questions@freebsd.org
Subject:   Automating removal of users password
Message-ID:  <199508062012.NAA01949@wsantee.oz.net>

next in thread | raw e-mail | index | archive | help
Are there any commands in FreeBSD to automatically archive and remove
a users account?  Sort of the reversal of 'adduser'.  I haven't found
one so I'm in the process of whipping up a simple script just for my
system.  Problem is, I'm not sure how to automatically delete a user
from the password files.  I'm assuming something like (leaving out
details like saving old umask, directory, etc):

umask 077
chdir /etc
/usr/bin/grep -v ${username} master.passwd > master.passwd.XXXXXX
/usr/sbin/pwd_mkdb -p master.passwd.XXXXXX
/bin/rm -f master.passwd.XXXXXX

but I want to bounce it off some other people first before I go
through a trial run.  I realize I'd need to use shlock(1) to provide a
lockfile so multiple copies of pwd_mkdb(8) aren't run at the same
time.

Along those lines, what do I need to check for to make sure some other
process isn't locking the passwd file?  In other works, what is the
name of the lockfile used that passwd(1), chpass(1), vipw(1), etc. use
to make sure that only one copy of pwd_mkdb(8) can be run at a time?

Cheers,
-- 
( -Wes Santee                        | You're never dead 'til you're )
( wsantee@wsantee.oz.net             | out of quarters.  --InSoc     )
( http://www.oz.net/~wsantee         \------------------------------ )
( O S / 2  W A R P                                     F r e e B S D )



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199508062012.NAA01949>