Managing passwd files outside /etc

Matthew Seaman m.seaman at
Wed Nov 26 07:47:19 PST 2003

On Wed, Nov 26, 2003 at 03:11:05PM +0000, Wayne Pascoe wrote:

> I'm trying to setup a virtual hosting mail environment. I want to
> maintain passwd files for users in my virtual tree. Is it possible to do
> this with the passwd utility ? For example, I want to manage
> /etc/virtual/
> I can't find a flag telling it to work with a file outside of /etc

pw(8) understands a -V etcdir option for operating on passwd files
away from the usual location.  As the man page says:

                   pw will prompt for the user's password if -h 0 is given,
                   nominating stdin as the file descriptor on which to read
                   the password.  Note that this password will be read only
                   once and is intended for use by a script rather than for
                   interactive use.  If you wish to have new password confir-
                   mation along the lines of passwd(1), this must be imple-
                   mented as part of an interactive script that calls pw.

Alternatives: If you set up a jail(8) you can use the regular
passwd(1) program within it to manage user accounts, so long as you
can arrange for the passwd file to have the path /etc/master.passwd
relative to the jail root.  You can do similar things with chroot(8),
but in either case beware that you will have to provide access to any
shlibs loaded subsequent to the chroot or jail call.

You could use NIS or LDAP to store the account details for the virtual
users: with a little admin-fu it should be possible to get the mail
system to refer to those user databases, but have the base system use
/etc/master.passwd for system level logins.  Learing about SASL will
pay dividends here.



Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP:         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :

More information about the freebsd-questions mailing list