Debian Codegraph @

upstream/debian-unstable/man5/limits.conf.5

raw
1 '\" t
2 .\" Title: limits.conf
3 .\" Author: [see the "AUTHOR" section]
4 .\" Generator: DocBook XSL Stylesheets v1.79.2 <http://docbook.sf.net/>
5 .\" Date: 06/29/2025
6 .\" Manual: Linux-PAM Manual
7 .\" Source: Linux-PAM
8 .\" Language: English
9 .\"
10 .TH "LIMITS\&.CONF" "5" "06/29/2025" "Linux\-PAM" "Linux\-PAM Manual"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 limits.conf \- configuration file for the pam_limits module
32 .SH "DESCRIPTION"
33 .PP
34 The
35 \fIpam_limits\&.so\fR
36 module applies ulimit limits, nice priority and number of simultaneous login sessions limit to user login sessions\&. This description of the configuration file syntax applies to the
37 /etc/security/limits\&.conf
38 file and
39 *\&.conf
40 files in the
41 /etc/security/limits\&.d
42 directory\&.
43 .PP
44 The syntax of the lines is as follows:
45 .PP
46 \fI<domain>\fR
47 \fI<type>\fR
48 \fI<item>\fR
49 \fI<value>\fR
50 .PP
51 The fields listed above should be filled as follows:
52 .PP
53 <domain>
54 .RS 4
55 .sp
56 .RS 4
57 .ie n \{\
58 \h'-04'\(bu\h'+03'\c
59 .\}
60 .el \{\
61 .sp -1
62 .IP \(bu 2.3
63 .\}
64 a username
65 .RE
66 .sp
67 .RS 4
68 .ie n \{\
69 \h'-04'\(bu\h'+03'\c
70 .\}
71 .el \{\
72 .sp -1
73 .IP \(bu 2.3
74 .\}
75 a groupname, with
76 \fB@group\fR
77 syntax\&. This should not be confused with netgroups\&.
78 .RE
79 .sp
80 .RS 4
81 .ie n \{\
82 \h'-04'\(bu\h'+03'\c
83 .\}
84 .el \{\
85 .sp -1
86 .IP \(bu 2.3
87 .\}
88 the wildcard
89 \fB*\fR, for default entry\&.
90 .RE
91 .sp
92 .RS 4
93 .ie n \{\
94 \h'-04'\(bu\h'+03'\c
95 .\}
96 .el \{\
97 .sp -1
98 .IP \(bu 2.3
99 .\}
100 the wildcard
101 \fB%\fR, for maxlogins limit only, can also be used with
102 \fB%group\fR
103 syntax\&. If the
104 \fB%\fR
105 wildcard is used alone it is identical to using
106 \fB*\fR
107 with maxsyslogins limit\&. With a group specified after
108 \fB%\fR
109 it limits the total number of logins of all users that are member of the group\&.
110 .RE
111 .sp
112 .RS 4
113 .ie n \{\
114 \h'-04'\(bu\h'+03'\c
115 .\}
116 .el \{\
117 .sp -1
118 .IP \(bu 2.3
119 .\}
120 an uid range specified as
121 \fI<min_uid>\fR\fB:\fR\fI<max_uid>\fR\&. If min_uid is omitted, the match is exact for the max_uid\&. If max_uid is omitted, all uids greater than or equal min_uid match\&.
122 .RE
123 .sp
124 .RS 4
125 .ie n \{\
126 \h'-04'\(bu\h'+03'\c
127 .\}
128 .el \{\
129 .sp -1
130 .IP \(bu 2.3
131 .\}
132 a gid range specified as
133 \fB@\fR\fI<min_gid>\fR\fB:\fR\fI<max_gid>\fR\&. If min_gid is omitted, the match is exact for the max_gid\&. If max_gid is omitted, all gids greater than or equal min_gid match\&. For the exact match all groups including the user\*(Aqs supplementary groups are examined\&. For the range matches only the user\*(Aqs primary group is examined\&.
134 .RE
135 .sp
136 .RS 4
137 .ie n \{\
138 \h'-04'\(bu\h'+03'\c
139 .\}
140 .el \{\
141 .sp -1
142 .IP \(bu 2.3
143 .\}
144 a gid specified as
145 \fB%:\fR\fI<gid>\fR
146 applicable to maxlogins limit only\&. It limits the total number of logins of all users that are member of the group with the specified gid\&.
147 .RE
148 .sp
149 \fBNOTE:\fR
150 group and wildcard limits are not applied to the root user\&. To set a limit for the root user, this field must contain the literal username
151 \fBroot\fR\&.
152 .RE
153 .PP
154 <type>
155 .RS 4
156 .PP
157 hard
158 .RS 4
159 for enforcing
160 \fBhard\fR
161 resource limits\&. These limits are set by the superuser and enforced by the Kernel\&. Users cannot raise their own requirement of system resources above such values\&.
162 .RE
163 .PP
164 soft
165 .RS 4
166 for enforcing
167 \fBsoft\fR
168 resource limits\&. These limits are ones that the user can move up or down within the permitted range by any pre\-existing
169 \fBhard\fR
170 limits\&. The values specified with this token can be thought of as
171 \fIdefault\fR
172 values, for normal system usage\&.
173 .RE
174 .PP
175 \-
176 .RS 4
177 for enforcing both
178 \fBsoft\fR
179 and
180 \fBhard\fR
181 resource limits together\&.
182 .sp
183 Note, if you specify a type of \*(Aq\-\*(Aq but neglect to supply the item and value fields then the module will never enforce any limits on the specified user/group etc\&. \&.
184 .RE
185 .RE
186 .PP
187 <item>
188 .RS 4
189 .PP
190 core
191 .RS 4
192 limits the core file size (KB)
193 .RE
194 .PP
195 data
196 .RS 4
197 maximum data size (KB)
198 .RE
199 .PP
200 fsize
201 .RS 4
202 maximum filesize (KB)
203 .RE
204 .PP
205 memlock
206 .RS 4
207 maximum locked\-in\-memory address space (KB)
208 .RE
209 .PP
210 nofile
211 .RS 4
212 maximum number of open file descriptors
213 .RE
214 .PP
215 rss
216 .RS 4
217 maximum resident set size (KB) (Ignored in Linux 2\&.4\&.30 and higher)
218 .RE
219 .PP
220 stack
221 .RS 4
222 maximum stack size (KB)
223 .RE
224 .PP
225 cpu
226 .RS 4
227 maximum CPU time (minutes)
228 .RE
229 .PP
230 nproc
231 .RS 4
232 maximum number of processes
233 .RE
234 .PP
235 as
236 .RS 4
237 address space limit (KB)
238 .RE
239 .PP
240 maxlogins
241 .RS 4
242 maximum number of logins for this user (this limit does not apply to user with
243 \fIuid=0\fR)
244 .RE
245 .PP
246 maxsyslogins
247 .RS 4
248 maximum number of all logins on system; user is not allowed to log\-in if total number of all user logins is greater than specified number (this limit does not apply to user with
249 \fIuid=0\fR)
250 .RE
251 .PP
252 nonewprivs
253 .RS 4
254 value of 0 or 1; if set to 1 disables acquiring new privileges by invoking prctl(PR_SET_NO_NEW_PRIVS)
255 .RE
256 .PP
257 priority
258 .RS 4
259 the priority to run user process with (negative values boost process priority)
260 .RE
261 .PP
262 locks
263 .RS 4
264 maximum locked files (Linux 2\&.4 and higher)
265 .RE
266 .PP
267 sigpending
268 .RS 4
269 maximum number of pending signals (Linux 2\&.6 and higher)
270 .RE
271 .PP
272 msgqueue
273 .RS 4
274 maximum memory used by POSIX message queues (bytes) (Linux 2\&.6 and higher)
275 .RE
276 .PP
277 nice
278 .RS 4
279 maximum nice priority allowed to raise to (Linux 2\&.6\&.12 and higher) values: [\-20,19]
280 .RE
281 .PP
282 rtprio
283 .RS 4
284 maximum realtime priority allowed for non\-privileged processes (Linux 2\&.6\&.12 and higher)
285 .RE
286 .PP
287 \fBchroot\fR
288 .RS 4
289 the directory to chroot the user to
290 .RE
291 .RE
292 .PP
293 All items support the values
294 \fI\-1\fR,
295 \fIunlimited\fR
296 or
297 \fIinfinity\fR
298 indicating no limit, except for
299 \fBpriority\fR,
300 \fBnice\fR, and
301 \fBnonewprivs\fR\&. If
302 \fBnofile\fR
303 is to be set to one of these values, it will be set to the contents of /proc/sys/fs/nr_open instead (see setrlimit(3))\&.
304 .PP
305 If a hard limit or soft limit of a resource is set to a valid value, but outside of the supported range of the local system, the system may reject the new limit or unexpected behavior may occur\&. If the control value
306 \fIrequired\fR
307 is used, the module will reject the login if a limit could not be set\&.
308 .PP
309 In general, individual limits have priority over group limits, so if you impose no limits for
310 \fIadmin\fR
311 group, but one of the members in this group have a limits line, the user will have its limits set according to this line\&.
312 .PP
313 Also, please note that all limit settings are set
314 \fIper login\fR\&. They are not global, nor are they permanent; existing only for the duration of the session\&. One exception is the
315 \fImaxlogin\fR
316 option, this one is system wide\&. But there is a race, concurrent logins at the same time will not always be detect as such but only counted as one\&.
317 .PP
318 In the
319 \fIlimits\fR
320 configuration file, the \*(Aq\fB#\fR\*(Aq character introduces a comment \- after which the rest of the line is ignored\&.
321 .PP
322 The pam_limits module does report configuration problems found in its configuration file and errors via
323 \fBsyslog\fR(3)\&.
324 .SH "EXAMPLES"
325 .PP
326 These are some example lines which might be specified in
327 /etc/security/limits\&.conf\&.
328 .sp
329 .if n \{\
330 .RS 4
331 .\}
332 .nf
333 * soft core 0
334 root hard core 100000
335 * hard nofile 512
336 @student hard nproc 20
337 @faculty soft nproc 20
338 @faculty hard nproc 50
339 ftp hard nproc 0
340 @student \- maxlogins 4
341 @student \- nonewprivs 1
342 :123 hard cpu 5000
343 @500: soft cpu 10000
344 600:700 hard locks 10
345
346 .fi
347 .if n \{\
348 .RE
349 .\}
350 .SH "SEE ALSO"
351 .PP
352 \fBpam_limits\fR(8),
353 \fBpam.d\fR(5),
354 \fBpam\fR(7),
355 \fBgetrlimit\fR(2),
356 \fBgetrlimit\fR(3p)
357 .SH "AUTHOR"
358 .PP
359 pam_limits was initially written by Cristian Gafton <gafton@redhat\&.com>