xref: /freebsd/lib/libutil/login.conf.5 (revision 0ddf9be1f0723916ebd4feb7313d64dffab0c2bb)
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.\" $Id$
21.\"
22.Dd November 22, 1996
23.Dt LOGIN.CONF 5
24.Os FreeBSD
25.Sh NAME
26.Nm login.conf
27.Nd login class capability database
28.Sh SYNOPSIS
29.Pa /etc/login.conf ,
30.Pa ~/.login_conf
31.Sh DESCRIPTION
32login.conf contains various attributes and capabilities of login classes.
33A login class (an optional annotation against each record in the user
34account database,
35.Pa /etc/master.passwd )
36determines session accounting, resource limits and user environment settings.
37It is used by various programs in the system to set up a user's login
38environment and to enforce policy, accounting and administrative restrictions.
39It also provides the means by which users are able to be
40authenticated to the system and the types of authentication available.
41.Pp
42A special record "default" in the system user class capability database
43.Pa /etc/login.conf
44is used automatically for any
45non-root user without a valid login class in
46.Pa /etc/master.passwd .
47A user with a uid of 0 without a valid login class will use the record
48"root" if it exists, or "default" if not.
49.Pp
50In FreeBSD, users may individually create a file called
51.Pa .login_conf
52in their home directory using the same format, consisting of a single
53entry with a record id of "me".
54If present, this file is used by
55.Xr login 1
56to set user-defined environment settings which override those specified
57in the system login capabilities database.
58Only a subset of login capabilities may be overridden, typically those
59which do not involve authentication, resource limits and accounting.
60.Pp
61Records in a class capabilities database consist of a number of
62colon-separated fields.
63The first entry for each record gives one or more names that a record is
64to be known by, each separated by a '|' character.
65The first name is the most common abbreviation.
66The last name given should be a long name that is more descriptive
67of the capability entry, and all others are synonyms.
68All names but the last should be in lower case and contain no blanks;
69the last name may contain upper case characters and blanks for
70readability.
71.Pp
72See
73.Xr getcap 3
74for a more in-depth description of the format of a capability database.
75.Sh CAPABILITIES
76Fields within each record in the database follow the
77.Xr getcap 3
78conventions for boolean, type string
79.Ql \&=
80and type numeric
81.Ql \&# ,
82although type numeric is depreciated in favour of the string format and
83either form is accepted for a numeric datum.
84Values fall into the following categories:
85.Bl -tag -width "program"
86.It file
87Path name to a data file
88.It program
89Path name to an executable file
90.It list
91A list of values (or pairs of values) separated by commas or spaces
92.It path
93A space or comma separated list of path names, following the usual csh
94conventions (leading tilde with and without username being expanded to
95home directories etc.)
96.It number
97A numeric value, either decimal (default), hexadecimal (with leading 0x),
98or octal (with a leading 0).
99With a numeric type, only one numeric value is allowed.
100Numeric types may also be specified in string format (ie. the capability
101tag being delimited from the value by '=' instead of '#').
102Whichever method is used, then all records in the database must use the
103same method to allow values to be correctly overridden in interpolated
104records.
105.It size
106A number which expresses a size.
107The default interpretation of a value is the number of bytes, but a
108suffix may specify alternate units:
109.Bl -tag -offset indent -compact -width xxxx
110.It b
111explicitly selects 512-byte blocks
112.It k
113selects kilobytes (1024 bytes)
114.It m
115specifies a multiplier of 1 megabyte (1048576 bytes),
116.It g
117specifies units of gigabytes, and
118.It t
119represents terrabytes.
120.El
121A size value is a numeric quantity and case of the suffix is not significant.
122Concatenated values are added together.
123.It time
124A period of time, by default in seconds.
125A prefix may specify a different unit;
126.Bl -tag -offset indent -compact -width xxxx
127.It y
128indicates the number of 365 day years,
129.It w
130indicates the number of weeks,
131.It d
132the number of days,
133.It h
134the number of minutes, and
135.It s
136the number of seconds.
137.El
138Concatenated values are added together.
139For example, 2 hours and 40 minutes may be written either as
1409600s, 160m or 2h40m.
141.El
142.Pp
143The usual convention to interpolate capability entries using the special
144.Em tc=value
145notation may be used.
146.Pp
147.Sh RESOURCE LIMITS
148.Bl -column coredumpsize indent indent
149.Sy Name	Type	Notes	Description
150.It cputime	time		CPU usage limit.
151.It filesize	size		Maximum file size limit.
152.It datasize	size		Maximum data size limit.
153.It stacksize	size		Maximum stack size limit.
154.It coredumpsize	size		Maximum coredump size limit.
155.It memoryuse	size		Maximum of core memory use size limit.
156.It memorylocked	size		Maximum locked in core memory size limit.
157.It maxproc	number		Maximum number of processes.
158.It openfiles	number		Maximum number of open files per process.
159.El
160.Pp
161These resource limit entries actually specify both the maximum
162and current limits (see
163.Xr getrlimit 2 ).
164The current (soft) limit is the one normally used, although the user is permitted
165to increase the current limit to the maximum (hard) limit.
166The maximum and current limits may be specified individually by appending a
167-max or -cur to the capability name.
168.Pp
169.Sh ENVIRONMENT
170.Bl -column ignorenologin indent xbinxxusrxbin
171.Sy Name	Type	Notes	Description
172.It charset	string		Set $MM_CHARSET environment variable to the specified
173value.
174.It hushlogin	bool	false	Same as having a ~/.hushlogin file.
175.It ignorenologin	bool	false	Login not prevented by nologin.
176.It lang	string		Set $LANG environment variable to the specified value.
177.It manpath	path		Default search path for manpages.
178.It nologin	file		If the file exists it will be displayed and
179the login session will be terminated.
180.It path	path	/bin /usr/bin	Default search path.
181.It priority	number		Initial priority (nice) level.
182.It requirehome 	bool	false	Require a valid home directory to login.
183.It setenv	list		A comma-separated list of environment variables and
184values to which they are to be set.
185.It shell	prog		Session shell to execute rather than the
186shell specified in the passwd file. The SHELL environment variable will
187contain the shell specified in the password file.
188.It term	string	su	Default terminal type if not able to determine from
189other means.
190.It timezone	string		Default value of $TZ environment variable.
191.It umask	number	022	Initial umask. Should always have a leading 0 to
192ensure octal interpretation.
193.It welcome	file	/etc/motd	File containing welcome message.
194.El
195.Pp
196.Sh AUTHENTICATION
197.Bl -column minpasswordlen indent indent
198.Sy Name	Type	Notes	Description
199.It minpasswordlen	number	6	The minimum length a local password may be.
200.\" .It approve	program 	Program to approve login.
201.It auth	list	passwd	Allowed authentication styles. The first value is the
202default style.
203.It auth-<type>	list		Allowed authentication styles for the
204authentication type 'type'.
205.It copyright	file		File containing additional copyright information
206.\".It widepasswords	bool	false	Use the wide password format. The wide password
207.\" format allows up to 128 significant characters in the password.
208.It host.allow	list		List of remote host wildcards from which users in
209the class may access.
210.It host.deny	list		List of remote host wildcards from which users in
211the class may not access.
212.It times.allow 	list		List of time periods during which
213logins are allowed.
214.It times.deny	list		List of time periods during which logins are
215disallowed.
216.It tty.allow	list		List of ttys and ttygroups which users
217in the class may use for access.
218.It tty.deny	list		List of ttys and ttygroups which users
219in the class may not use for access.
220.El
221.Pp
222These fields are intended to be used by
223.Xr passwd 1
224and other programs in the login authentication system.
225.Pp
226Capabilities that set environment variables are scanned for both
227.Ql \&~
228and
229.Ql \&$
230characters, which are substituted for a user's home directory and name
231respectively.
232To pass these characters literally into the environment variable, escape
233the character by preceding it with a backslash '\\'.
234.Pp
235The
236.Em host.allow
237and
238.Em host.deny
239entries are comma separated lists used for checking remote access to the system,
240and consist of a list of hostnames and/or IP addresses against which remote
241network logins are checked.
242Items in these lists may contain wildcards in the form used by shell programs
243for wildcard matching (See
244.Xr fnmatch 3
245for details on the implementation).
246The check on hosts is made against both the remote system's Internet address
247and hostname (if available).
248If both lists are empty or not specified, then logins from any remote host
249are allowed.
250If host.allow contains one or more hosts, then only remote systems matching
251any of the items in that list are allowed to log in.
252If host.deny contains one or more hosts, then a login from any matching hosts
253will be disallowed.
254.Pp
255The
256.Em times.allow
257and
258.Em times.deny
259entries consist of a comma-separated list of time periods during which the users
260in a class are allowed to be logged in.
261These are expressed as one or more day codes followed by a start and end times
262expressed in 24 hour format, separated by a hyphen or dash.
263For example, MoThSa0200-1300 translates to Monday, Thursday and Saturday between
264the hours of 2 am and 1 p.m..
265If both of these time lists are empty, users in the class are allowed access at
266any time.
267If
268.Em times.allow
269is specified, then logins are only allowed during the periods given.
270If
271.Em times.deny
272is specified, then logins are denied during the periods given, regardless of whether
273one of the periods specified in
274.Em times.allow
275applies.
276.Pp
277Note that
278.Xr login 1
279enforces only that the actual login falls within periods allowed by these entries.
280Further enforcement over the life of a session requires a separate daemon to
281monitor transitions from an allowed period to a non-allowed one.
282.Pp
283The
284.Em tty.allow
285and
286.Em tty.deny
287entries contain a comma-separated list of tty devices (without the /dev/ prefix)
288that a user in a class may use to access the system, and/or a list of ttygroups
289(See
290.Xr getttyent 3
291and
292.Xr ttys 5
293for information on ttygroups).
294If neither entry exists, then the choice of login device used by the user is
295unrestricted.
296If only
297.Em tty.allow
298is specified, then the user is restricted only to ttys in the given
299group or device list.
300If only
301.Em tty.deny
302is specified, then the user is prevented from using the specified devices or
303devices in the group.
304If both lists are given and are non-empty, the user is restricted to those
305devices allowed by tty.allow that are not available by tty.deny.
306.Sh ACCOUNTING LIMITS
307.Bl -column passwordperiod indent indent
308.Sy Name	Type	Notes	Description
309.It accounted	bool	false	Enable session time accounting for all users
310in this class.
311.It autodelete	time		Time after expiry when account is auto-deleted.
312.It bootfull	bool	false	Enable 'boot only if ttygroup is full' strategy
313when terminating sessions.
314.It daytime	time		Maximum login time per day.
315.It expireperiod	time		Time for expiry allocation.
316.It graceexpire 	time		Grace days for expired account.
317.It gracetime	time		Additional grace login time allowed.
318.It host.accounted	list		List of remote host wildcards from which
319login sessions will be accounted.
320.It host.exempt 	list		List of remote host wildcards from which
321login session accounting is exempted.
322.It idletime	time		Maximum idle time before logout.
323.It monthtime 	time		Maximum login time per month.
324.It passwordtime	time		Time for password expiry.
325.It refreshtime 	time		New time allowed on account refresh.
326.It refreshperiod	str		How often account time is refreshed.
327.It sessiontime 	time		Maximum login time per session.
328.It sessionlimit	number		Maximum number of concurrent
329login sessions on ttys in any group.
330.It tty.accounted	list		List of ttys and ttygroups for which
331login accounting is active.
332.It tty.exempt	list		List of ttys and ttygroups for which login accounting
333is exempt.
334.It warnexpire	time		Advance notice for pending account expiry.
335.It warnpassword	time		Advance notice for pending password expiry.
336.It warntime	time		Advance notice for pending out-of-time.
337.It weektime	time		Maximum login time per week.
338.El
339.Pp
340These fields are used by the time accounting system, which regulates,
341controls and records user login access.
342.Pp
343The
344.Em ttys.accounted
345and
346.Em ttys.exempt
347fields operate in a similar manner to
348.Em ttys.allow
349and
350.Em ttys.deny
351as explained
352above.
353Similarly with the
354.Em host.accounted
355and
356.Em host.exempt
357lists.
358.Sh SEE ALSO
359.Xr login 1 ,
360.Xr getcap 3 ,
361.Xr getttyent 3 ,
362.Xr login_cap 3 ,
363.Xr login_class 3 ,
364.Xr ttys 5
365