xref: /freebsd/lib/libutil/login.conf.5 (revision 06c3fb27)
1.\" Copyright (c) 1996 David Nugent <davidn@blaze.net.au>
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, is permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice immediately at the beginning of the file, without modification,
9.\"    this list of conditions, and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\" 3. This work was done expressly for inclusion into FreeBSD.  Other use
14.\"    is permitted provided this notation is included.
15.\" 4. Absolutely no warranty of function or purpose is made by the author
16.\"    David Nugent.
17.\" 5. Modifications may be freely made to this file providing the above
18.\"    conditions are met.
19.\"
20.Dd June 28, 2023
21.Dt LOGIN.CONF 5
22.Os
23.Sh NAME
24.Nm login.conf
25.Nd login class capability database
26.Sh SYNOPSIS
27.Pa /etc/login.conf ,
28.Pa ~/.login_conf
29.Sh DESCRIPTION
30.Nm
31contains various attributes and capabilities of login classes.
32A login class (an optional annotation against each record in the user
33account database,
34.Pa /etc/master.passwd )
35determines session accounting, resource limits and user environment settings.
36It is used by various programs in the system to set up a user's login
37environment and to enforce policy, accounting and administrative restrictions.
38It also provides the means by which users are able to be
39authenticated to the system and the types of authentication available.
40Attributes in addition to the ones described here are available with
41third-party packages.
42.Pp
43A special record "default" in the system user class capability database
44.Pa /etc/login.conf
45is used automatically for any
46non-root user without a valid login class in
47.Pa /etc/master.passwd .
48A user with a uid of 0 without a valid login class will use the record
49"root" if it exists, or "default" if not.
50.Pp
51Users may individually create a file called
52.Pa .login_conf
53in their home directory using the same format, consisting of a single
54entry with a record id of "me".
55If present, this file is used by
56.Xr login 1
57to set user-defined environment settings which override those specified
58in the system login capabilities database.
59Only a subset of login capabilities may be overridden, typically those
60which do not involve authentication, resource limits and accounting.
61.Pp
62Records in a class capabilities database consist of a number of
63colon-separated fields.
64The first entry for each record gives one or more names that a record is
65to be known by, each separated by a '|' character.
66The first name is the most common abbreviation.
67The last name given should be a long name that is more descriptive
68of the capability entry, and all others are synonyms.
69All names but the last should be in lower case and contain no blanks;
70the last name may contain upper case characters and blanks for
71readability.
72.Pp
73Note that since a colon
74.Pq Ql :\&
75is used to separate capability entries, a
76.Ql \ec
77escape sequence must be used to embed a literal colon in the
78value or name of a capability.
79.Pp
80The default
81.Pa /etc/login.conf
82shipped with
83.Fx
84is an out of the box configuration.
85Whenever changes to this, or
86the user's
87.Pa ~/.login_conf ,
88file are made, the modifications will not be picked up until
89.Xr cap_mkdb 1
90is used to compile the file into a database.
91This database file will have a
92.Pa .db
93extension and is accessed through
94.Xr cgetent 3 .
95See
96.Xr getcap 3
97for a more in-depth description of the format of a capability database.
98.Sh CAPABILITIES
99Fields within each record in the database follow the
100.Xr getcap 3
101conventions for boolean, type string
102.Ql \&=
103and type numeric
104.Ql \&# ,
105although type numeric is deprecated in favour of the string format and
106either form is accepted for a numeric datum.
107Values fall into the following categories:
108.Bl -tag -width "program"
109.It bool
110If the name is present, then the boolean value is true; otherwise, it is
111false
112.It file
113Path name to a data file
114.It program
115Path name to an executable file
116.It list
117A list of values (or pairs of values) separated by commas or spaces
118.It path
119A space or comma separated list of path names, following the usual csh
120conventions (leading tilde with and without username being expanded to
121home directories etc.)
122.It number
123A numeric value, either decimal (default), hexadecimal (with leading 0x),
124or octal (with a leading 0).
125With a numeric type, only one numeric value is allowed.
126Numeric types may also be specified in string format (i.e., the capability
127tag being delimited from the value by '=' instead of '#').
128Whichever method is used, then all records in the database must use the
129same method to allow values to be correctly overridden in interpolated
130records.
131A numeric value may be infinite.
132.It size
133A number which expresses a size.
134The default interpretation of a value is the number of bytes, but a
135suffix may specify alternate units:
136.Bl -tag -offset indent -compact -width xxxx
137.It b
138explicitly selects 512-byte blocks
139.It k
140selects kilobytes (1024 bytes)
141.It m
142specifies a multiplier of 1 megabyte (1048576 bytes),
143.It g
144specifies units of gigabytes, and
145.It t
146represents terabytes.
147.El
148A size value is a numeric quantity and case of the suffix is not significant.
149Concatenated values are added together.
150A size value may be infinite.
151.It time
152A period of time, by default in seconds.
153A prefix may specify a different unit:
154.Bl -tag -offset indent -compact -width xxxx
155.It y
156indicates the number of 365 day years,
157.It w
158indicates the number of weeks,
159.It d
160the number of days,
161.It h
162the number of hours,
163.It m
164the number of minutes, and
165.It s
166the number of seconds.
167.El
168Concatenated values are added together.
169For example, 2 hours and 40 minutes may be written either as
1709600s, 160m or 2h40m.
171A time value may be infinite.
172.El
173.Pp
174.Dq infinity ,
175.Dq inf ,
176.Dq unlimited ,
177.Dq unlimit,
178and -1
179are considered infinite values.
180.Pp
181The usual convention to interpolate capability entries using the special
182.Em tc=value
183notation may be used.
184.Sh RESOURCE LIMITS
185.Bl -column pseudoterminals indent indent
186.It Sy "Name	Type	Notes	Description"
187.It "coredumpsize	size		Maximum coredump size limit."
188.It "cputime	time		CPU usage limit."
189.It "datasize	size		Maximum data size limit."
190.It "filesize	size		Maximum file size limit."
191.It "maxproc	number		Maximum number of processes."
192.It "memorylocked	size		Maximum locked in core memory size limit."
193.It "memoryuse	size		Maximum of core memory use size limit."
194.It "openfiles	number		Maximum number of open files per process."
195.It "sbsize	size		Maximum permitted socketbuffer size."
196.It "vmemoryuse	size		Maximum permitted total VM usage per process."
197.It "stacksize	size		Maximum stack size limit."
198.It "pseudoterminals	number		Maximum number of pseudo-terminals."
199.It "swapuse	size		Maximum swap space size limit."
200.It "umtxp	number		Maximum number of process-shared pthread locks."
201.El
202.Pp
203These resource limit entries actually specify both the maximum
204and current limits (see
205.Xr getrlimit 2 ) .
206The current (soft) limit is the one normally used, although the user is
207permitted to increase the current limit to the maximum (hard) limit.
208The maximum and current limits may be specified individually by appending a
209-max or -cur to the capability name.
210.Sh ENVIRONMENT
211.Bl -column ignorenologin indent xbinxxusrxbin
212.It Sy "Name	Type	Notes	Description"
213.It "charset	string		Set $MM_CHARSET environment variable to the specified"
214value.
215.It "cpumask	string		List of cpus to bind the user to."
216The syntax is the same as for the
217.Fl l
218argument of
219.Xr cpuset 1
220or the word
221.Ql default .
222If set to
223.Ql default
224no action is taken.
225.It "hushlogin	bool	false	Same as having a ~/.hushlogin file."
226.It "ignorenologin	bool	false	Login not prevented by nologin."
227.It "ftp-chroot	bool	false	Limit FTP access with"
228.Xr chroot 2
229to the
230.Ev HOME
231directory of the user.
232See
233.Xr ftpd 8
234for details.
235.It "label	string		Default MAC policy; see"
236.Xr maclabel 7 .
237.It "lang	string		Set $LANG environment variable to the specified value."
238.It "mail	string		Set $MAIL environment variable to the specified value."
239.It "manpath	path		Default search path for manpages."
240.It "nocheckmail	bool	false	Display mail status at login."
241.It "nologin	file		If the file exists it will be displayed and"
242the login session will be terminated.
243.It "path	path	/bin /usr/bin	Default search path."
244.It "priority	number		Initial priority (nice) level."
245.It "requirehome 	bool	false	Require a valid home directory to login."
246.It "setenv	list		A comma-separated list of environment variables and"
247values to which they are to be set.
248Values containing commas must be quoted.
249.It "shell	prog		Session shell to execute rather than the"
250shell specified in the passwd file.
251The SHELL environment variable will
252contain the shell specified in the password file.
253.It "term	string		Default terminal type if not able to determine"
254from other means.
255.It "timezone	string		Default value of $TZ environment variable."
256.It "umask	number	022	Initial umask. Should always have a leading 0 to"
257ensure octal interpretation.
258.It "welcome	file	/etc/motd	File containing welcome message."
259.El
260.Sh AUTHENTICATION
261.Bl -column passwd_prompt indent indent
262.It Sy "Name	Type	Notes	Description"
263.\" .It "approve	program 	Program to approve login.
264.It "copyright	file		File containing additional copyright information"
265.It "host.allow	list		List of remote host wildcards from which users in"
266the class may access.
267.It "host.deny	list		List of remote host wildcards from which users"
268in the class may not access.
269.It "login_prompt	string		The login prompt given by"
270.Xr login 1
271.It "login-backoff	number	3	The number of login attempts"
272allowed before the backoff delay is inserted after each subsequent
273attempt.
274The backoff delay is the number of tries above
275.Em login-backoff
276multiplied by 5 seconds.
277.It "login-retries	number	10	The number of login attempts"
278allowed before the login fails.
279.It "passwd_format	string	sha512	The encryption format that new or"
280changed passwords will use.
281Valid values include "des", "md5", "blf", "sha256" and "sha512"; see
282.Xr crypt 3
283for details.
284NIS clients using a
285.No non- Ns Fx
286NIS server should probably use "des".
287.It "passwd_prompt	string		The password prompt presented by"
288.Xr login 1
289.It "passwordtime	time		Used by"
290.Xr passwd 1
291to set next password expiry date.
292.It "times.allow 	list		List of time periods during which"
293logins are allowed.
294.It "times.deny	list		List of time periods during which logins are"
295disallowed.
296.It "ttys.allow	list		List of ttys and ttygroups which users"
297in the class may use for access.
298.It "ttys.deny	list		List of ttys and ttygroups which users"
299in the class may not use for access.
300.It "warnexpire	time		Advance notice for pending account expiry."
301.It "warnpassword	time		Advance notice for pending password expiry."
302.\".It "widepasswords	bool	false	Use the wide password format. The wide password
303.\" format allows up to 128 significant characters in the password.
304.El
305.Pp
306These fields are intended to be used by
307.Xr passwd 1
308and other programs in the login authentication system.
309.Pp
310Capabilities that set environment variables are scanned for both
311.Ql \&~
312and
313.Ql \&$
314characters, which are substituted for a user's home directory and name
315respectively.
316To pass these characters literally into the environment variable, escape
317the character by preceding it with a backslash '\\'.
318.Pp
319The
320.Em host.allow
321and
322.Em host.deny
323entries are comma separated lists used for checking remote access to the system,
324and consist of a list of hostnames and/or IP addresses against which remote
325network logins are checked.
326Items in these lists may contain wildcards in the form used by shell programs
327for wildcard matching (See
328.Xr fnmatch 3
329for details on the implementation).
330The check on hosts is made against both the remote system's Internet address
331and hostname (if available).
332If both lists are empty or not specified, then logins from any remote host
333are allowed.
334If host.allow contains one or more hosts, then only remote systems matching
335any of the items in that list are allowed to log in.
336If host.deny contains one or more hosts, then a login from any matching hosts
337will be disallowed.
338.Pp
339The
340.Em times.allow
341and
342.Em times.deny
343entries consist of a comma-separated list of time periods during which the users
344in a class are allowed to be logged in.
345These are expressed as one or more day codes followed by a start and end times
346expressed in 24 hour format, separated by a hyphen or dash.
347For example, MoThSa0200-1300 translates to Monday, Thursday and Saturday between
348the hours of 2 am and 1 p.m..
349If both of these time lists are empty, users in the class are allowed access at
350any time.
351If
352.Em times.allow
353is specified, then logins are only allowed during the periods given.
354If
355.Em times.deny
356is specified, then logins are denied during the periods given, regardless of whether
357one of the periods specified in
358.Em times.allow
359applies.
360.Pp
361Note that
362.Xr login 1
363enforces only that the actual login falls within periods allowed by these entries.
364Further enforcement over the life of a session requires a separate daemon to
365monitor transitions from an allowed period to a non-allowed one.
366.Pp
367The
368.Em ttys.allow
369and
370.Em ttys.deny
371entries contain a comma-separated list of tty devices (without the /dev/ prefix)
372that a user in a class may use to access the system, and/or a list of ttygroups
373(See
374.Xr getttyent 3
375and
376.Xr ttys 5
377for information on ttygroups).
378If neither entry exists, then the choice of login device used by the user is
379unrestricted.
380If only
381.Em ttys.allow
382is specified, then the user is restricted only to ttys in the given
383group or device list.
384If only
385.Em ttys.deny
386is specified, then the user is prevented from using the specified devices or
387devices in the group.
388If both lists are given and are non-empty, the user is restricted to those
389devices allowed by ttys.allow that are not available by ttys.deny.
390.Pp
391The
392.Em minpasswordlen
393and
394.Em minpasswordcase
395facilities for enforcing restrictions on password quality, which used
396to be supported by
397.Nm ,
398have been superseded by the
399.Xr pam_passwdqc 8
400PAM module.
401.Sh RESERVED CAPABILITIES
402The following capabilities are reserved for the purposes indicated and
403may be supported by third-party software.
404They are not implemented in the base system.
405.Bl -column host.accounted indent indent
406.It Sy "Name	Type	Notes	Description"
407.It "accounted	bool	false	Enable session time accounting for all users"
408in this class.
409.It "auth	list	passwd	Allowed authentication styles."
410The first item is the default style.
411.It "auth-" Ns Ar type Ta "list		Allowed authentication styles for the"
412authentication
413.Ar type .
414.It "autodelete	time		Time after expiry when account is auto-deleted."
415.It "bootfull	bool	false	Enable 'boot only if ttygroup is full' strategy"
416when terminating sessions.
417.It "daytime	time		Maximum login time per day."
418.It "expireperiod	time		Time for expiry allocation."
419.It "graceexpire 	time		Grace days for expired account."
420.It "gracetime	time		Additional grace login time allowed."
421.It "host.accounted	list		List of remote host wildcards from which"
422login sessions will be accounted.
423.It "host.exempt 	list		List of remote host wildcards from which"
424login session accounting is exempted.
425.It "idletime	time		Maximum idle time before logout."
426.It "minpasswordlen	number	6	The minimum length a local"
427password may be.
428.It "mixpasswordcase	bool	true	Whether"
429.Xr passwd 1
430will warn the user if an all lower case password is entered.
431.It "monthtime 	time		Maximum login time per month."
432.It "refreshtime 	time		New time allowed on account refresh."
433.It "refreshperiod	str		How often account time is refreshed."
434.It "sessiontime 	time		Maximum login time per session."
435.It "sessionlimit	number		Maximum number of concurrent"
436login sessions on ttys in any group.
437.It "ttys.accounted	list		List of ttys and ttygroups for which"
438login accounting is active.
439.It "ttys.exempt	list		List of ttys and ttygroups for which login accounting"
440is exempt.
441.It "warntime	time		Advance notice for pending out-of-time."
442.It "weektime	time		Maximum login time per week."
443.El
444.Pp
445The
446.Em ttys.accounted
447and
448.Em ttys.exempt
449fields operate in a similar manner to
450.Em ttys.allow
451and
452.Em ttys.deny
453as explained
454above.
455Similarly with the
456.Em host.accounted
457and
458.Em host.exempt
459lists.
460.Sh SEE ALSO
461.Xr cap_mkdb 1 ,
462.Xr login 1 ,
463.Xr chroot 2 ,
464.Xr getcap 3 ,
465.Xr getttyent 3 ,
466.Xr login_cap 3 ,
467.Xr login_class 3 ,
468.Xr pam 3 ,
469.Xr passwd 5 ,
470.Xr ttys 5 ,
471.Xr ftpd 8 ,
472.Xr pam_passwdqc 8
473.Sh HISTORY
474The file
475.Nm
476first appeared in
477.Fx 2.1.5 .
478