limits.conf.5 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. '\" t
  2. .\" Title: limits.conf
  3. .\" Author: [see the "AUTHOR" section]
  4. .\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
  5. .\" Date: 09/03/2021
  6. .\" Manual: Linux-PAM Manual
  7. .\" Source: Linux-PAM Manual
  8. .\" Language: English
  9. .\"
  10. .TH "LIMITS\&.CONF" "5" "09/03/2021" "Linux-PAM Manual" "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. \fB<domain>\fR
  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. .RE
  149. .PP
  150. \fB<type>\fR
  151. .RS 4
  152. .PP
  153. \fBhard\fR
  154. .RS 4
  155. for enforcing
  156. \fBhard\fR
  157. resource limits\&. These limits are set by the superuser and enforced by the Kernel\&. The user cannot raise his requirement of system resources above such values\&.
  158. .RE
  159. .PP
  160. \fBsoft\fR
  161. .RS 4
  162. for enforcing
  163. \fBsoft\fR
  164. resource limits\&. These limits are ones that the user can move up or down within the permitted range by any pre\-existing
  165. \fBhard\fR
  166. limits\&. The values specified with this token can be thought of as
  167. \fIdefault\fR
  168. values, for normal system usage\&.
  169. .RE
  170. .PP
  171. \fB\-\fR
  172. .RS 4
  173. for enforcing both
  174. \fBsoft\fR
  175. and
  176. \fBhard\fR
  177. resource limits together\&.
  178. .sp
  179. 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\&. \&.
  180. .RE
  181. .RE
  182. .PP
  183. \fB<item>\fR
  184. .RS 4
  185. .PP
  186. \fBcore\fR
  187. .RS 4
  188. limits the core file size (KB)
  189. .RE
  190. .PP
  191. \fBdata\fR
  192. .RS 4
  193. maximum data size (KB)
  194. .RE
  195. .PP
  196. \fBfsize\fR
  197. .RS 4
  198. maximum filesize (KB)
  199. .RE
  200. .PP
  201. \fBmemlock\fR
  202. .RS 4
  203. maximum locked\-in\-memory address space (KB)
  204. .RE
  205. .PP
  206. \fBnofile\fR
  207. .RS 4
  208. maximum number of open file descriptors
  209. .RE
  210. .PP
  211. \fBrss\fR
  212. .RS 4
  213. maximum resident set size (KB) (Ignored in Linux 2\&.4\&.30 and higher)
  214. .RE
  215. .PP
  216. \fBstack\fR
  217. .RS 4
  218. maximum stack size (KB)
  219. .RE
  220. .PP
  221. \fBcpu\fR
  222. .RS 4
  223. maximum CPU time (minutes)
  224. .RE
  225. .PP
  226. \fBnproc\fR
  227. .RS 4
  228. maximum number of processes
  229. .RE
  230. .PP
  231. \fBas\fR
  232. .RS 4
  233. address space limit (KB)
  234. .RE
  235. .PP
  236. \fBmaxlogins\fR
  237. .RS 4
  238. maximum number of logins for this user (this limit does not apply to user with
  239. \fIuid=0\fR)
  240. .RE
  241. .PP
  242. \fBmaxsyslogins\fR
  243. .RS 4
  244. 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
  245. \fIuid=0\fR)
  246. .RE
  247. .PP
  248. \fBnonewprivs\fR
  249. .RS 4
  250. value of 0 or 1; if set to 1 disables acquiring new privileges by invoking prctl(PR_SET_NO_NEW_PRIVS)
  251. .RE
  252. .PP
  253. \fBpriority\fR
  254. .RS 4
  255. the priority to run user process with (negative values boost process priority)
  256. .RE
  257. .PP
  258. \fBlocks\fR
  259. .RS 4
  260. maximum locked files (Linux 2\&.4 and higher)
  261. .RE
  262. .PP
  263. \fBsigpending\fR
  264. .RS 4
  265. maximum number of pending signals (Linux 2\&.6 and higher)
  266. .RE
  267. .PP
  268. \fBmsgqueue\fR
  269. .RS 4
  270. maximum memory used by POSIX message queues (bytes) (Linux 2\&.6 and higher)
  271. .RE
  272. .PP
  273. \fBnice\fR
  274. .RS 4
  275. maximum nice priority allowed to raise to (Linux 2\&.6\&.12 and higher) values: [\-20,19]
  276. .RE
  277. .PP
  278. \fBrtprio\fR
  279. .RS 4
  280. maximum realtime priority allowed for non\-privileged processes (Linux 2\&.6\&.12 and higher)
  281. .RE
  282. .RE
  283. .PP
  284. All items support the values
  285. \fI\-1\fR,
  286. \fIunlimited\fR
  287. or
  288. \fIinfinity\fR
  289. indicating no limit, except for
  290. \fBpriority\fR,
  291. \fBnice\fR, and
  292. \fBnonewprivs\fR\&. If
  293. \fBnofile\fR
  294. 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))\&.
  295. .PP
  296. 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
  297. \fIrequired\fR
  298. is used, the module will reject the login if a limit could not be set\&.
  299. .PP
  300. In general, individual limits have priority over group limits, so if you impose no limits for
  301. \fIadmin\fR
  302. group, but one of the members in this group have a limits line, the user will have its limits set according to this line\&.
  303. .PP
  304. Also, please note that all limit settings are set
  305. \fIper login\fR\&. They are not global, nor are they permanent; existing only for the duration of the session\&. One exception is the
  306. \fImaxlogin\fR
  307. 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\&.
  308. .PP
  309. In the
  310. \fIlimits\fR
  311. configuration file, the \*(Aq\fB#\fR\*(Aq character introduces a comment \- after which the rest of the line is ignored\&.
  312. .PP
  313. The pam_limits module does report configuration problems found in its configuration file and errors via
  314. \fBsyslog\fR(3)\&.
  315. .SH "EXAMPLES"
  316. .PP
  317. These are some example lines which might be specified in
  318. /etc/security/limits\&.conf\&.
  319. .sp
  320. .if n \{\
  321. .RS 4
  322. .\}
  323. .nf
  324. * soft core 0
  325. * hard nofile 512
  326. @student hard nproc 20
  327. @faculty soft nproc 20
  328. @faculty hard nproc 50
  329. ftp hard nproc 0
  330. @student \- maxlogins 4
  331. @student \- nonewprivs 1
  332. :123 hard cpu 5000
  333. @500: soft cpu 10000
  334. 600:700 hard locks 10
  335. .fi
  336. .if n \{\
  337. .RE
  338. .\}
  339. .SH "SEE ALSO"
  340. .PP
  341. \fBpam_limits\fR(8),
  342. \fBpam.d\fR(5),
  343. \fBpam\fR(8),
  344. \fBgetrlimit\fR(2),
  345. \fBgetrlimit\fR(3p)
  346. .SH "AUTHOR"
  347. .PP
  348. pam_limits was initially written by Cristian Gafton <gafton@redhat\&.com>