Safely modifying a passwd file (in a perl script, e.g.)

mf mf at ircam.UUCP
Thu Mar 3 09:04:51 AEST 1988


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).



More information about the Comp.unix.wizards mailing list