xref: /freebsd/lib/libutil/login.conf.5 (revision 11afcc8f9f96d657b8e6f7547c02c1957331fc96)
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: login.conf.5,v 1.14 1998/02/14 16:12:53 steve Exp $
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 terabytes.
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 hours,
135.It m
136the number of minutes, and
137.It s
138the number of seconds.
139.El
140Concatenated values are added together.
141For example, 2 hours and 40 minutes may be written either as
1429600s, 160m or 2h40m.
143.El
144.Pp
145The usual convention to interpolate capability entries using the special
146.Em tc=value
147notation may be used.
148.Pp
149.Sh RESOURCE LIMITS
150.Bl -column coredumpsize indent indent
151.Sy Name	Type	Notes	Description
152.It cputime	time		CPU usage limit.
153.It filesize	size		Maximum file size limit.
154.It datasize	size		Maximum data size limit.
155.It stacksize	size		Maximum stack size limit.
156.It coredumpsize	size		Maximum coredump size limit.
157.It memoryuse	size		Maximum of core memory use size limit.
158.It memorylocked	size		Maximum locked in core memory size limit.
159.It maxproc	number		Maximum number of processes.
160.It openfiles	number		Maximum number of open files per process.
161.El
162.Pp
163These resource limit entries actually specify both the maximum
164and current limits (see
165.Xr getrlimit 2 ).
166The current (soft) limit is the one normally used, although the user is permitted
167to increase the current limit to the maximum (hard) limit.
168The maximum and current limits may be specified individually by appending a
169-max or -cur to the capability name.
170.Pp
171.Sh ENVIRONMENT
172.Bl -column ignorenologin indent xbinxxusrxbin
173.Sy Name	Type	Notes	Description
174.It charset	string		Set $MM_CHARSET environment variable to the specified
175value.
176.It hushlogin	bool	false	Same as having a ~/.hushlogin file.
177.It ignorenologin	bool	false	Login not prevented by nologin.
178.It lang	string		Set $LANG environment variable to the specified value.
179.It manpath	path		Default search path for manpages.
180.It nologin	file		If the file exists it will be displayed and
181the login session will be terminated.
182.It path	path	/bin /usr/bin	Default search path.
183.It priority	number		Initial priority (nice) level.
184.It requirehome 	bool	false	Require a valid home directory to login.
185.It setenv	list		A comma-separated list of environment variables and
186values to which they are to be set.
187.It shell	prog		Session shell to execute rather than the
188shell specified in the passwd file. The SHELL environment variable will
189contain the shell specified in the password file.
190.It term	string	su	Default terminal type if not able to determine from
191other means.
192.It timezone	string		Default value of $TZ environment variable.
193.It umask	number	022	Initial umask. Should always have a leading 0 to
194ensure octal interpretation.
195.It welcome	file	/etc/motd	File containing welcome message.
196.El
197.Pp
198.Sh AUTHENTICATION
199.Bl -column minpasswordlen indent indent
200.Sy Name	Type	Notes	Description
201.It minpasswordlen	number	6	The minimum length a local password may be.
202.\" .It approve	program 	Program to approve login.
203.It auth	list	passwd	Allowed authentication styles. The first value is the
204default style.
205.It auth-<type>	list		Allowed authentication styles for the
206authentication type 'type'.
207.It copyright	file		File containing additional copyright information
208.\".It widepasswords	bool	false	Use the wide password format. The wide password
209.\" format allows up to 128 significant characters in the password.
210.It host.allow	list		List of remote host wildcards from which users in
211the class may access.
212.It host.deny	list		List of remote host wildcards from which users in
213the class may not access.
214.It times.allow 	list		List of time periods during which
215logins are allowed.
216.It times.deny	list		List of time periods during which logins are
217disallowed.
218.It ttys.allow	list		List of ttys and ttygroups which users
219in the class may use for access.
220.It ttys.deny	list		List of ttys and ttygroups which users
221in the class may not use for access.
222.El
223.Pp
224These fields are intended to be used by
225.Xr passwd 1
226and other programs in the login authentication system.
227.Pp
228Capabilities that set environment variables are scanned for both
229.Ql \&~
230and
231.Ql \&$
232characters, which are substituted for a user's home directory and name
233respectively.
234To pass these characters literally into the environment variable, escape
235the character by preceding it with a backslash '\\'.
236.Pp
237The
238.Em host.allow
239and
240.Em host.deny
241entries are comma separated lists used for checking remote access to the system,
242and consist of a list of hostnames and/or IP addresses against which remote
243network logins are checked.
244Items in these lists may contain wildcards in the form used by shell programs
245for wildcard matching (See
246.Xr fnmatch 3
247for details on the implementation).
248The check on hosts is made against both the remote system's Internet address
249and hostname (if available).
250If both lists are empty or not specified, then logins from any remote host
251are allowed.
252If host.allow contains one or more hosts, then only remote systems matching
253any of the items in that list are allowed to log in.
254If host.deny contains one or more hosts, then a login from any matching hosts
255will be disallowed.
256.Pp
257The
258.Em times.allow
259and
260.Em times.deny
261entries consist of a comma-separated list of time periods during which the users
262in a class are allowed to be logged in.
263These are expressed as one or more day codes followed by a start and end times
264expressed in 24 hour format, separated by a hyphen or dash.
265For example, MoThSa0200-1300 translates to Monday, Thursday and Saturday between
266the hours of 2 am and 1 p.m..
267If both of these time lists are empty, users in the class are allowed access at
268any time.
269If
270.Em times.allow
271is specified, then logins are only allowed during the periods given.
272If
273.Em times.deny
274is specified, then logins are denied during the periods given, regardless of whether
275one of the periods specified in
276.Em times.allow
277applies.
278.Pp
279Note that
280.Xr login 1
281enforces only that the actual login falls within periods allowed by these entries.
282Further enforcement over the life of a session requires a separate daemon to
283monitor transitions from an allowed period to a non-allowed one.
284.Pp
285The
286.Em ttys.allow
287and
288.Em ttys.deny
289entries contain a comma-separated list of tty devices (without the /dev/ prefix)
290that a user in a class may use to access the system, and/or a list of ttygroups
291(See
292.Xr getttyent 3
293and
294.Xr ttys 5
295for information on ttygroups).
296If neither entry exists, then the choice of login device used by the user is
297unrestricted.
298If only
299.Em ttys.allow
300is specified, then the user is restricted only to ttys in the given
301group or device list.
302If only
303.Em ttys.deny
304is specified, then the user is prevented from using the specified devices or
305devices in the group.
306If both lists are given and are non-empty, the user is restricted to those
307devices allowed by ttys.allow that are not available by ttys.deny.
308.Sh ACCOUNTING LIMITS
309.Bl -column passwordperiod indent indent
310.Sy Name	Type	Notes	Description
311.It accounted	bool	false	Enable session time accounting for all users
312in this class.
313.It autodelete	time		Time after expiry when account is auto-deleted.
314.It bootfull	bool	false	Enable 'boot only if ttygroup is full' strategy
315when terminating sessions.
316.It daytime	time		Maximum login time per day.
317.It expireperiod	time		Time for expiry allocation.
318.It graceexpire 	time		Grace days for expired account.
319.It gracetime	time		Additional grace login time allowed.
320.It host.accounted	list		List of remote host wildcards from which
321login sessions will be accounted.
322.It host.exempt 	list		List of remote host wildcards from which
323login session accounting is exempted.
324.It idletime	time		Maximum idle time before logout.
325.It monthtime 	time		Maximum login time per month.
326.It passwordtime	time		Time for password expiry.
327.It refreshtime 	time		New time allowed on account refresh.
328.It refreshperiod	str		How often account time is refreshed.
329.It sessiontime 	time		Maximum login time per session.
330.It sessionlimit	number		Maximum number of concurrent
331login sessions on ttys in any group.
332.It ttys.accounted	list		List of ttys and ttygroups for which
333login accounting is active.
334.It ttys.exempt	list		List of ttys and ttygroups for which login accounting
335is exempt.
336.It warnexpire	time		Advance notice for pending account expiry.
337.It warnpassword	time		Advance notice for pending password expiry.
338.It warntime	time		Advance notice for pending out-of-time.
339.It weektime	time		Maximum login time per week.
340.El
341.Pp
342These fields are used by the time accounting system, which regulates,
343controls and records user login access.
344.Pp
345The
346.Em ttys.accounted
347and
348.Em ttys.exempt
349fields operate in a similar manner to
350.Em ttys.allow
351and
352.Em ttys.deny
353as explained
354above.
355Similarly with the
356.Em host.accounted
357and
358.Em host.exempt
359lists.
360.Sh SEE ALSO
361.Xr login 1 ,
362.Xr getcap 3 ,
363.Xr getttyent 3 ,
364.Xr login_cap 3 ,
365.Xr login_class 3 ,
366.Xr passwd 5 ,
367.Xr ttys 5
368