1.\" Copyright (c) 1983, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 3. Neither the name of the University nor the names of its contributors 13.\" may be used to endorse or promote products derived from this software 14.\" without specific prior written permission. 15.\" 16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26.\" SUCH DAMAGE. 27.\" 28.Dd November 12, 2022 29.Dt VIPW 8 30.Os 31.Sh NAME 32.Nm vipw 33.Nd edit the password file 34.Sh SYNOPSIS 35.Nm 36.Op Fl d Ar directory 37.Sh DESCRIPTION 38The 39.Nm 40utility edits the password file after setting the appropriate locks, 41and does any necessary processing after the password file is unlocked. 42If the password file is already locked for editing by another user, 43.Nm 44will ask you 45to try again later. 46The default editor for 47.Nm 48is 49.Xr vi 1 . 50.Pp 51When run without options, 52.Nm 53will work with the password files in 54.Pa /etc . 55The 56.Fl d 57option may be used to specify an alternative 58.Ar directory 59to work with. 60.Pp 61The 62.Nm 63utility performs a number of consistency checks on the password entries, 64and will not allow a password file with a 65.Dq mangled 66entry to be 67installed. 68If 69.Nm 70rejects the new password file, the user is prompted to re-enter 71the edit session. 72.Pp 73Once the information has been verified, 74.Nm 75uses 76.Xr pwd_mkdb 8 77to update the user database. 78This is run in the background, and, 79at very large sites could take several minutes. 80Until this update 81is completed, the password file is unavailable for other updates 82and the new information is not available to programs. 83.Sh ENVIRONMENT 84If the following environment variable exists it will be utilized by 85.Nm : 86.Bl -tag -width PW_SCAN_BIG_IDS 87.It Ev EDITOR 88The editor specified by the string 89.Ev EDITOR 90will be invoked instead of the default editor 91.Xr vi 1 . 92This can be used to allow a script to non-interactively modify the 93password file. 94.It Ev PW_SCAN_BIG_IDS 95See 96.Xr pwd_mkdb 8 . 97.El 98.Sh FILES 99.Bl -tag -width "/etc/master.passwdXXX" -compact 100.It Pa /etc/master.passwd 101Current password file. 102.It Pa /etc/passwd 103Legacy password file. 104.It Pa /etc/ptmp 105Password lock file. 106.It Pa /etc/pwd.db 107Insecure password database file. 108.It Pa /etc/spwd.db 109Secure password database file. 110.El 111.Sh SEE ALSO 112.Xr chpass 1 , 113.Xr passwd 1 , 114.Xr passwd 5 , 115.Xr adduser 8 , 116.Xr pw 8 , 117.Xr pwd_mkdb 8 118.Sh HISTORY 119The 120.Nm 121utility appeared in 122.Bx 4.0 . 123.Sh BUGS 124The mechanism for checking for password file modifications requires that 125the modification time of the password file changes. 126This means that in a default configuration where file system timestamps 127are not calculated with sub-second precision, 128.Ev EDITOR 129has to run for at least one second. 130Non-interactive editor scripts should invoke 131.Xr sleep 1 132or equivalent to ensure this happens. 133