Path: utzoo!mnetor!uunet!mcvax!inria!ircam!mf From: mf@ircam.UUCP (mf) Newsgroups: comp.unix.wizards Subject: Safely modifying a passwd file (in a perl script, e.g.) Message-ID: <411@ircam.UUCP> Date: 2 Mar 88 23:04:51 GMT Organization: Inst. de Rech. et Coord. Acoustique-Musique, Paris Lines: 12 Keywords: passwd vipw perl sh csh 4.2bsd Suppose /tmp/newpasswd is the new passwd file you wish to have (as created, say, by a perl/csh script a program). Say (in the script or the program) setenv EDITOR cp\ /tmp/newpasswd; /etc/vipw (not to forget to escape the blank). I.e., in csh you would just say that, in perl you would use the "system" call. vipw uses whatever is in the EDITOR environment variable as the first part of a command whose argument is a temporary file containing a copy of the original /etc/passwd and at the end of which should be replaced by the new contents).