PW.CONF(5)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

πŸŽ€ PW.CONF(5) β€” like, the whole vibe πŸŽ€

okay bestie, so this is PW.CONF(5) from the File Formats Manual section β€” it's the manual page for pw.conf, and it's genuinely more useful than it looks. let's get into it πŸ’…


✨ NAME ✨

pw.conf β€” the format of the pw.conf configuration file. that's it, that's the name, she's simple and she knows it 🫢


πŸ’– DESCRIPTION πŸ’–

so the file /etc/pw.conf holds configuration data for the pw(8) utility β€” and if you don't know her, pw(8) is the tool that maintains the system password and group files, which is how you add, delete, and change users and groups. iconic behaviour honestly.

you can change this file two ways: through the pw(8) command using the useradd command and the -D option, or by just opening it up and editing it directly with a text editor. both valid, both slay πŸ”₯

each line in /etc/pw.conf is treated either as a comment or as configuration data. blank lines and lines starting with a # character? comments, bestie, ignored. any remaining lines get examined for a leading keyword, followed by the corresponding data. that's the whole system, no cap.

πŸ”‘ the keywords pw(8) actually recognizes

  • defaultpasswd β€” affects the passwords generated for new users
  • reuseuids β€” reuse gaps in uid sequences
  • reusegids β€” reuse gaps in gid sequences
  • nispasswd β€” path to the NIS passwd database
  • skeleton β€” where to obtain default home contents
  • newmail β€” mail to send to new users
  • logfile β€” log user/group modifications to this file
  • home β€” root directory for home directories
  • homemode β€” permissions for home directory
  • shellpath β€” paths in which to locate shell programs
  • shells β€” list of valid shells (without path)
  • defaultshell β€” default shell (without path)
  • defaultgroup β€” default group
  • extragroups β€” add new users to this groups
  • defaultclass β€” place new users in this login class
  • minuid, maxuid β€” range of valid default user ids
  • mingid, maxgid β€” range of valid default group ids
  • expire_days β€” days after which account expires
  • password_days β€” days after which password expires

πŸ—οΈ valid values for defaultpasswd

  • no β€” disable login on newly created accounts
  • yes β€” force the password to be the account name
  • none β€” force a blank password
  • random β€” generate a random password
⚠️ okay so listen β€” the second and third options (yes and none) are insecure and should be avoided if possible on a publicly accessible system. like, fr fr, don't do it on a shared box.

the first option (no) requires that the superuser run passwd(1) to set a password before the account may be used. this may also be useful for creating administrative accounts. the final option (random) causes pw(8) to respond by printing a randomly generated password on stdout β€” and this one is the preferred and most secure option πŸ‘‘. pw(8) also gives you a way to set a specific password for the new user via a filehandle (because command lines are not secure, periodt).


πŸŒ€ reuseuids & reusegids

both reuseuids and reusegids determine the method by which new user and group id numbers get generated. a yes in this field makes pw(8) search for the first unused user or group id within the allowed range. a no ensures that no other existing user or group id within the range is numerically lower than the new one being generated β€” so it avoids reusing gaps in the sequence that previous user or group deletions left behind. clever, right? πŸ’…

also note: if the default group isn't specified using the defaultgroup keyword, pw(8) will create a new group for the user and attempt to keep the new user's uid and gid the same. and if the new user's uid happens to already be in use as a group id? then the next available group id is chosen instead. she adapts. 🌸

πŸ“’ nispasswd

on NIS servers that maintain a separate passwd database from /etc/master.passwd, this option lets that additional file be concurrently updated as user records are added, modified or removed. if it's blank or set to 'no', no additional database is updated. an absolute pathname must be used β€” no relative nonsense, iykyk.

🧺 skeleton

the skeleton keyword nominates a directory from which the contents of a user's new home directory is constructed. this is /usr/share/skel by default. pw(8)'s -m option causes the user's home directory to be created and populated using the files contained in the skeleton directory. it's giving "starter pack" ✨

πŸ“¨ newmail

to send an initial email to new users, use the newmail keyword to specify a path name to a file containing the message body of the message to be sent. to avoid sending mail when accounts are created, leave this entry blank or specify 'no'.

πŸͺ΅ logfile

the logfile option allows logging of password file modifications into the nominated log file. to avoid creating or adding to such a logfile, leave this field blank or specify 'no'.

🏠 home

the home keyword is mandatory β€” like, you literally cannot skip it β€” and it specifies the location of the directory in which all new user home directories get created.

πŸ” homemode

the homemode keyword is optional. it specifies the creation mask of the user's home directory and is modified by umask(2).

🐚 shellpath

the shellpath keyword specifies a list of directories β€” separated by colons : β€” which contain the programs used by the login shells.

🐚 shells

the shells keyword specifies a list of programs available for use as login shells. this list is a comma-separated list of shell names, which should not contain a path. these shells must exist in one of the directories nominated by shellpath.

🐚 defaultshell

the defaultshell keyword nominates which shell program to use for new users when none is specified on the pw(8) command line.

πŸ‘― defaultgroup

the defaultgroup keyword defines the primary group (the group id number in the password file) used for new accounts. if left blank, or the word 'no' is used, then each new user will have a corresponding group of their own created automatically. this is the recommended procedure for new users, because it best secures each user's files against interference by other users of the system β€” irrespective of the umask normally used by the user. main character energy for every single user, honestly πŸ”₯

πŸ‘―β€β™€οΈ extragroups

the extragroups keyword provides an automatic means of placing new users into groups within the /etc/groups file. super useful where all users share some resources, and preferable to placing users into the same primary group. the effect of this keyword can be overridden using the -G option on the pw(8) command line.

πŸŽ“ defaultclass

the defaultclass field determines the login class (see login.conf(5)) that new users will be allocated, unless overwritten by pw(8).

πŸ”’ minuid, maxuid, mingid, maxgid

these keywords determine the allowed ranges of automatically allocated user and group id numbers. the default values for both user and group ids are 1000 and 32000 as minimum and maximum respectively. the user and group id's actually used when creating an account with pw(8) may be overridden using the -u and -g command line options.

⏳ expire_days & password_days

these are used to automatically calculate the number of days from the date on which an account is created when the account will expire, or when the user will be forced to change the account's password. a value of '0' in either field will disable the corresponding (account or password) expiration date. so 0 is basically the "never mind, we're immortal" setting πŸ’€


🚧 LIMITS 🚧

the maximum line length of /etc/pw.conf is 1024 characters. longer lines get skipped and treated as comments β€” so if you write a whole essay on one line, bestie, it's just gonna be ignored 😭


πŸ“ FILES πŸ“

/etc/pw.conf
/etc/passwd
/etc/master.passwd
/etc/group

πŸ‘€ SEE ALSO πŸ‘€

passwd(1), umask(2), group(5), login.conf(5), passwd(5), pw(8)


that's the whole page, bestie β€” go forth and manage those users responsibly πŸ¦‹πŸ’œ

this cutie comes to you from Debian, dated March 30, 2007 β€” vintage, but still serving βœ¨πŸŽ€

πŸ“¦ where this page comes from