From owner-freebsd-questions Sun Aug 6 13:15:50 1995 Return-Path: questions-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.11/8.6.6) id NAA03111 for questions-outgoing; Sun, 6 Aug 1995 13:15:50 -0700 Received: from emerald.oz.net (emerald.oz.net [198.68.184.2]) by freefall.cdrom.com (8.6.11/8.6.6) with ESMTP id NAA03103 for ; Sun, 6 Aug 1995 13:15:49 -0700 Received: from wsantee.oz.net by emerald.oz.net via ESMTP (8.6.12/930416.SGI) for id UAA20814; Sun, 6 Aug 1995 20:13:04 GMT Received: (from wsantee@localhost) by wsantee.oz.net (8.6.11/8.6.9) id NAA01949 for questions@freebsd.org; Sun, 6 Aug 1995 13:12:36 -0700 From: Wes Santee Message-Id: <199508062012.NAA01949@wsantee.oz.net> Subject: Automating removal of users password To: questions@freebsd.org Date: Sun, 6 Aug 1995 13:12:35 -0700 (PDT) X-Mailer: ELM [version 2.4 PL24] Content-Type: text Content-Length: 1341 Sender: questions-owner@freebsd.org Precedence: bulk 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 )