161863Sbostic.\" Copyright (c) 1991, 1993
261863Sbostic.\"	The Regents of the University of California.  All rights reserved.
347158Sbostic.\"
451065Scael.\" %sccs.include.redist.roff%
547158Sbostic.\"
6*68955Sbostic.\"	@(#)pwd_mkdb.8	8.2 (Berkeley) 04/27/95
747158Sbostic.\"
851065Scael.Dd
951065Scael.Dt PWD_MKDB 8
1051065Scael.Os
1151065Scael.Sh NAME
1251065Scael.Nm pwd_mkdb
1351065Scael.Nd "generate the password databases"
1451065Scael.Sh SYNOPSIS
1551065Scael.Nm pwd_mkdb
1651065Scael.Op Fl p
1751065Scael.Ar file
1851065Scael.Sh DESCRIPTION
1951065Scael.Nm Pwd_mkdb
2047158Sbosticcreates
2151065Scael.Xr db 3
2247158Sbosticstyle secure and insecure databases for the specified file.
2351065ScaelThese databases are then installed into
2451065Scael.Dq Pa /etc/spwd.db
2551065Scaeland
2651065Scael.Dq Pa /etc/pwd.db
2751065Scaelrespectively.
2851065ScaelThe file is installed into
2951065Scael.Dq Pa /etc/master.passwd .
3047158SbosticThe file must be in the correct format (see
3151065Scael.Xr passwd 5 ) .
3247158SbosticIt is important to note that the format used in this system is
3347158Sbosticdifferent from the historic Version 7 style format.
3451065Scael.Pp
3547158SbosticThe options are as follows:
3651065Scael.Bl -tag -width flag
3751065Scael.It Fl p
3851065ScaelCreate a Version 7 style password file and install it into
3957521Sbostic.Dq Pa /etc/passwd .
4051065Scael.El
4151065Scael.Pp
4247158SbosticThe two databases differ in that the secure version contains the user's
4347158Sbosticencrypted password and the insecure version has an asterisk (``*'')
4451065Scael.Pp
4547158SbosticThe databases are used by the C library password routines (see
4651065Scael.Xr getpwent 3 ) .
4751065Scael.Pp
4851065Scael.Nm Pwd_mkdb
4947158Sbosticexits zero on success, non-zero on failure.
5051065Scael.Sh FILES
5151065Scael.Bl -tag -width Pa -compact
52*68955Sbostic.It Pa /etc/master.passwd
53*68955SbosticThe current password file.
54*68955Sbostic.It Pa /etc/passwd
55*68955SbosticA Version 7 format password file.
56*68955Sbostic.It Pa /etc/pwd.db
5751065ScaelThe insecure password database file.
58*68955Sbostic.It Pa /etc/pwd.db.tmp
5951065ScaelA temporary file.
60*68955Sbostic.It Pa /etc/spwd.db
6151065ScaelThe secure password database file.
62*68955Sbostic.It Pa /etc/spwd.db.tmp
6351065ScaelA temporary file.
6451065Scael.El
6551065Scael.Sh BUGS
6647158SbosticBecause of the necessity for atomic update of the password files,
6751065Scael.Nm pwd_mkdb
6847158Sbosticuses
6951065Scael.Xr rename 2
7047158Sbosticto install them.
7147158SbosticThis, however, requires that the file specified on the command line live
7251065Scaelon the same file system as the
7351065Scael.Dq Pa /etc
7451065Scaeldirectory.
7551065Scael.Pp
7647158SbosticThere are the obvious races with multiple people running
7751065Scael.Nm pwd_mkdb
7847158Sbosticon different password files at the same time.
7947158SbosticThe front-ends to
8051065Scael.Nm pwd_mkdb ,
8151065Scael.Xr chpass 1 ,
8251065Scael.Xr passwd 1
8347158Sbosticand
8451065Scael.Xr vipw 8 ,
8547158Sbostichandle the locking necessary to avoid this problem.
8651065Scael.Sh COMPATIBILITY
8747158SbosticPrevious versions of the system had a program similar to
8851065Scael.Nm pwd_mkdb ,
8951065Scael.Xr mkpasswd 8 ,
9047158Sbosticwhich built
9151065Scael.Xr dbm 3
9247158Sbosticstyle databases for the password file but depended on the calling programs
9347158Sbosticto install them.
9447158SbosticThe program was renamed in order that previous users of the program
9547158Sbosticnot be surprised by the changes in functionality.
9651065Scael.Sh SEE ALSO
9751065Scael.Xr chpass 1 ,
9851065Scael.Xr passwd 1 ,
9951065Scael.Xr db 3 ,
10051065Scael.Xr getpwent 3 ,
10151065Scael.Xr passwd 5 ,
10251065Scael.Xr vipw 8
103