| 1 |
.\" Copyright 1994-1995, Daniel Quinlan <[email protected]> |
| 2 |
.\" Copyright 2002-2017, Michael Kerrisk <[email protected]> |
| 3 |
.\" Copyright, Andries E. Brouwer <[email protected]> |
| 4 |
.\" Copyright, the authors of the Linux man-pages project |
| 5 |
.\" |
| 6 |
.\" SPDX-License-Identifier: GPL-3.0-or-later |
| 7 |
.\" |
| 8 |
.TH proc_sys_fs 5 2026-02-08 "Linux man-pages 6.18" |
| 9 |
.SH NAME |
| 10 |
/proc/sys/fs/ \- kernel variables related to filesystems |
| 11 |
.SH DESCRIPTION |
| 12 |
.TP |
| 13 |
.I /proc/sys/fs/ |
| 14 |
This directory contains the files and subdirectories for kernel variables |
| 15 |
related to filesystems. |
| 16 |
.TP |
| 17 |
.I /proc/sys/fs/aio\-max\-nr |
| 18 |
.TQ |
| 19 |
.IR /proc/sys/fs/aio\-nr " (both since Linux 2.6.4)" |
| 20 |
.I aio\-nr |
| 21 |
is the running total of the number of events specified by |
| 22 |
.BR io_setup (2) |
| 23 |
calls for all currently active AIO contexts. |
| 24 |
If |
| 25 |
.I aio\-nr |
| 26 |
reaches |
| 27 |
.IR aio\-max\-nr , |
| 28 |
then |
| 29 |
.BR io_setup (2) |
| 30 |
will fail with the error |
| 31 |
.BR EAGAIN . |
| 32 |
Raising |
| 33 |
.I aio\-max\-nr |
| 34 |
does not result in the preallocation or resizing |
| 35 |
of any kernel data structures. |
| 36 |
.TP |
| 37 |
.I /proc/sys/fs/binfmt_misc |
| 38 |
Documentation for files in this directory can be found |
| 39 |
in the Linux kernel source in the file |
| 40 |
.I Documentation/admin\-guide/binfmt\-misc.rst |
| 41 |
(or in |
| 42 |
.I Documentation/binfmt_misc.txt |
| 43 |
on older kernels). |
| 44 |
.TP |
| 45 |
.IR /proc/sys/fs/dentry\-state " (since Linux 2.2)" |
| 46 |
This file contains information about the status of the |
| 47 |
directory cache (dcache). |
| 48 |
The file contains six numbers, |
| 49 |
.IR nr_dentry , |
| 50 |
.IR nr_unused , |
| 51 |
.I age_limit |
| 52 |
(age in seconds), |
| 53 |
.I want_pages |
| 54 |
(pages requested by system) and two dummy values. |
| 55 |
.RS |
| 56 |
.IP \[bu] 3 |
| 57 |
.I nr_dentry |
| 58 |
is the number of allocated dentries (dcache entries). |
| 59 |
This field is unused in Linux 2.2. |
| 60 |
.IP \[bu] |
| 61 |
.I nr_unused |
| 62 |
is the number of unused dentries. |
| 63 |
.IP \[bu] |
| 64 |
.I age_limit |
| 65 |
.\" looks like this is unused in Linux 2.2 to Linux 2.6 |
| 66 |
is the age in seconds after which dcache entries |
| 67 |
can be reclaimed when memory is short. |
| 68 |
.IP \[bu] |
| 69 |
.I want_pages |
| 70 |
.\" looks like this is unused in Linux 2.2 to Linux 2.6 |
| 71 |
is nonzero when the kernel has called shrink_dcache_pages() and the |
| 72 |
dcache isn't pruned yet. |
| 73 |
.RE |
| 74 |
.TP |
| 75 |
.I /proc/sys/fs/dir\-notify\-enable |
| 76 |
This file can be used to disable or enable the |
| 77 |
.I dnotify |
| 78 |
interface described in |
| 79 |
.BR fcntl (2) |
| 80 |
on a system-wide basis. |
| 81 |
A value of 0 in this file disables the interface, |
| 82 |
and a value of 1 enables it. |
| 83 |
.TP |
| 84 |
.I /proc/sys/fs/dquot\-max |
| 85 |
This file shows the maximum number of cached disk quota entries. |
| 86 |
On some (2.4) systems, it is not present. |
| 87 |
If the number of free cached disk quota entries is very low and |
| 88 |
you have some awesome number of simultaneous system users, |
| 89 |
you might want to raise the limit. |
| 90 |
.TP |
| 91 |
.I /proc/sys/fs/dquot\-nr |
| 92 |
This file shows the number of allocated disk quota |
| 93 |
entries and the number of free disk quota entries. |
| 94 |
.TP |
| 95 |
.IR /proc/sys/fs/epoll/ " (since Linux 2.6.28)" |
| 96 |
This directory contains the file |
| 97 |
.IR max_user_watches , |
| 98 |
which can be used to limit the amount of kernel memory consumed by the |
| 99 |
.I epoll |
| 100 |
interface. |
| 101 |
For further details, see |
| 102 |
.BR epoll (7). |
| 103 |
.TP |
| 104 |
.I /proc/sys/fs/file\-max |
| 105 |
This file defines |
| 106 |
a system-wide limit on the number of open files for all processes. |
| 107 |
System calls that fail when encountering this limit fail with the error |
| 108 |
.BR ENFILE . |
| 109 |
(See also |
| 110 |
.BR setrlimit (2), |
| 111 |
which can be used by a process to set the per-process limit, |
| 112 |
.BR RLIMIT_NOFILE , |
| 113 |
on the number of files it may open.) |
| 114 |
If you get lots |
| 115 |
of error messages in the kernel log about running out of file handles |
| 116 |
(open file descriptions) |
| 117 |
(look for "VFS: file\-max limit <number> reached"), |
| 118 |
try increasing this value: |
| 119 |
.IP |
| 120 |
.in +4n |
| 121 |
.EX |
| 122 |
echo 100000 > /proc/sys/fs/file\-max |
| 123 |
.EE |
| 124 |
.in |
| 125 |
.IP |
| 126 |
Privileged processes |
| 127 |
.RB ( CAP_SYS_ADMIN ) |
| 128 |
can override the |
| 129 |
.I file\-max |
| 130 |
limit. |
| 131 |
.TP |
| 132 |
.I /proc/sys/fs/file\-nr |
| 133 |
This (read-only) file contains three numbers: |
| 134 |
the number of allocated file handles |
| 135 |
(i.e., the number of open file descriptions; |
| 136 |
see |
| 137 |
.BR open (2)); |
| 138 |
the number of free file handles; |
| 139 |
and the maximum number of file handles |
| 140 |
(i.e., the same value as |
| 141 |
.IR /proc/sys/fs/file\-max ). |
| 142 |
If the number of allocated file handles is close to the maximum, |
| 143 |
you should consider increasing the maximum. |
| 144 |
Before Linux 2.6, |
| 145 |
the kernel allocated file handles dynamically, |
| 146 |
but it didn't free them again. |
| 147 |
Instead the free file handles were kept in a list for reallocation; |
| 148 |
the "free file handles" value indicates the size of that list. |
| 149 |
A large number of free file handles indicates that |
| 150 |
there was a past peak in the usage of open file handles. |
| 151 |
Since Linux 2.6, |
| 152 |
the kernel does deallocate freed file handles, |
| 153 |
and the "free file handles" value is always zero. |
| 154 |
.TP |
| 155 |
.IR /proc/sys/fs/inode\-max " (only present until Linux 2.2)" |
| 156 |
This file contains the maximum number of in-memory inodes. |
| 157 |
This value should be 3\[en]4 times larger |
| 158 |
than the value in |
| 159 |
.IR file\-max , |
| 160 |
since |
| 161 |
.IR stdin , |
| 162 |
.I stdout |
| 163 |
and network sockets also need an inode to handle them. |
| 164 |
When you regularly run out of inodes, you need to increase this value. |
| 165 |
.IP |
| 166 |
Starting with Linux 2.4, |
| 167 |
there is no longer a static limit on the number of inodes, |
| 168 |
and this file is removed. |
| 169 |
.TP |
| 170 |
.I /proc/sys/fs/inode\-nr |
| 171 |
This file contains the first two values from |
| 172 |
.IR inode\-state . |
| 173 |
.TP |
| 174 |
.I /proc/sys/fs/inode\-state |
| 175 |
This file |
| 176 |
contains seven numbers: |
| 177 |
.IR nr_inodes , |
| 178 |
.IR nr_free_inodes , |
| 179 |
.IR preshrink , |
| 180 |
and four dummy values (always zero). |
| 181 |
.IP |
| 182 |
.I nr_inodes |
| 183 |
is the number of inodes the system has allocated. |
| 184 |
.\" This can be slightly more than |
| 185 |
.\" .I inode\-max |
| 186 |
.\" because Linux allocates them one page full at a time. |
| 187 |
.I nr_free_inodes |
| 188 |
represents the number of free inodes. |
| 189 |
.IP |
| 190 |
.I preshrink |
| 191 |
is nonzero when the |
| 192 |
.I nr_inodes |
| 193 |
> |
| 194 |
.I inode\-max |
| 195 |
and the system needs to prune the inode list instead of allocating more; |
| 196 |
since Linux 2.4, this field is a dummy value (always zero). |
| 197 |
.TP |
| 198 |
.IR /proc/sys/fs/inotify/ " (since Linux 2.6.13)" |
| 199 |
This directory contains files |
| 200 |
.IR max_queued_events ", " max_user_instances ", and " max_user_watches , |
| 201 |
that can be used to limit the amount of kernel memory consumed by the |
| 202 |
.I inotify |
| 203 |
interface. |
| 204 |
For further details, see |
| 205 |
.BR inotify (7). |
| 206 |
.TP |
| 207 |
.I /proc/sys/fs/lease\-break\-time |
| 208 |
This file specifies the grace period that the kernel grants to a process |
| 209 |
holding a file lease |
| 210 |
.RB ( fcntl (2)) |
| 211 |
after it has sent a signal to that process notifying it |
| 212 |
that another process is waiting to open the file. |
| 213 |
If the lease holder does not remove or downgrade the lease within |
| 214 |
this grace period, the kernel forcibly breaks the lease. |
| 215 |
.TP |
| 216 |
.I /proc/sys/fs/leases\-enable |
| 217 |
This file can be used to enable or disable file leases |
| 218 |
.RB ( fcntl (2)) |
| 219 |
on a system-wide basis. |
| 220 |
If this file contains the value 0, leases are disabled. |
| 221 |
A nonzero value enables leases. |
| 222 |
.TP |
| 223 |
.IR /proc/sys/fs/mount\-max " (since Linux 4.9)" |
| 224 |
.\" commit d29216842a85c7970c536108e093963f02714498 |
| 225 |
The value in this file specifies the maximum number of mounts that may exist |
| 226 |
in a mount namespace. |
| 227 |
The default value in this file is 100,000. |
| 228 |
.TP |
| 229 |
.IR /proc/sys/fs/mqueue/ " (since Linux 2.6.6)" |
| 230 |
This directory contains files |
| 231 |
.IR msg_max ", " msgsize_max ", and " queues_max , |
| 232 |
controlling the resources used by POSIX message queues. |
| 233 |
See |
| 234 |
.BR mq_overview (7) |
| 235 |
for details. |
| 236 |
.TP |
| 237 |
.IR /proc/sys/fs/nr_open " (since Linux 2.6.25)" |
| 238 |
.\" commit 9cfe015aa424b3c003baba3841a60dd9b5ad319b |
| 239 |
This file imposes a ceiling on the value to which the |
| 240 |
.B RLIMIT_NOFILE |
| 241 |
resource limit can be raised (see |
| 242 |
.BR getrlimit (2)). |
| 243 |
This ceiling is enforced for both unprivileged and privileged process. |
| 244 |
The default value in this file is 1048576. |
| 245 |
(Before Linux 2.6.25, the ceiling for |
| 246 |
.B RLIMIT_NOFILE |
| 247 |
was hard-coded to the same value.) |
| 248 |
.TP |
| 249 |
.I /proc/sys/fs/overflowgid |
| 250 |
.TQ |
| 251 |
.I /proc/sys/fs/overflowuid |
| 252 |
These files |
| 253 |
allow you to change the value of the fixed UID and GID. |
| 254 |
The default is 65534. |
| 255 |
Some filesystems support only 16-bit UIDs and GIDs, although in Linux |
| 256 |
UIDs and GIDs are 32 bits. |
| 257 |
When one of these filesystems is mounted |
| 258 |
with writes enabled, any UID or GID that would exceed 65535 is translated |
| 259 |
to the overflow value before being written to disk. |
| 260 |
.TP |
| 261 |
.IR /proc/sys/fs/pipe\-max\-size " (since Linux 2.6.35)" |
| 262 |
See |
| 263 |
.BR pipe (7). |
| 264 |
.TP |
| 265 |
.IR /proc/sys/fs/pipe\-user\-pages\-hard " (since Linux 4.5)" |
| 266 |
See |
| 267 |
.BR pipe (7). |
| 268 |
.TP |
| 269 |
.IR /proc/sys/fs/pipe\-user\-pages\-soft " (since Linux 4.5)" |
| 270 |
See |
| 271 |
.BR pipe (7). |
| 272 |
.TP |
| 273 |
.IR /proc/sys/fs/protected_fifos " (since Linux 4.19)" |
| 274 |
The value in this file is/can be set to one of the following: |
| 275 |
.RS |
| 276 |
.TP 4 |
| 277 |
0 |
| 278 |
Writing to FIFOs is unrestricted. |
| 279 |
.TP |
| 280 |
1 |
| 281 |
Don't allow |
| 282 |
.B O_CREAT |
| 283 |
.BR open (2) |
| 284 |
on FIFOs that the caller doesn't own in world-writable sticky directories, |
| 285 |
unless the FIFO is owned by the owner of the directory. |
| 286 |
.TP |
| 287 |
2 |
| 288 |
As for the value 1, |
| 289 |
but the restriction also applies to group-writable sticky directories. |
| 290 |
.RE |
| 291 |
.IP |
| 292 |
The intent of the above protections is to avoid unintentional writes to an |
| 293 |
attacker-controlled FIFO when a program expected to create a regular file. |
| 294 |
.TP |
| 295 |
.IR /proc/sys/fs/protected_hardlinks " (since Linux 3.6)" |
| 296 |
.\" commit 800179c9b8a1e796e441674776d11cd4c05d61d7 |
| 297 |
When the value in this file is 0, |
| 298 |
no restrictions are placed on the creation of hard links |
| 299 |
(i.e., this is the historical behavior before Linux 3.6). |
| 300 |
When the value in this file is 1, |
| 301 |
a hard link can be created to a target file |
| 302 |
only if one of the following conditions is true: |
| 303 |
.RS |
| 304 |
.IP \[bu] 3 |
| 305 |
The calling process has the |
| 306 |
.B CAP_FOWNER |
| 307 |
capability in its user namespace |
| 308 |
and the file UID has a mapping in the namespace. |
| 309 |
.IP \[bu] |
| 310 |
The filesystem UID of the process creating the link matches |
| 311 |
the owner (UID) of the target file |
| 312 |
(as described in |
| 313 |
.BR credentials (7), |
| 314 |
a process's filesystem UID is normally the same as its effective UID). |
| 315 |
.IP \[bu] |
| 316 |
All of the following conditions are true: |
| 317 |
.RS 4 |
| 318 |
.IP \[bu] 3 |
| 319 |
the target is a regular file; |
| 320 |
.IP \[bu] |
| 321 |
the target file does not have its set-user-ID mode bit enabled; |
| 322 |
.IP \[bu] |
| 323 |
the target file does not have both |
| 324 |
its set-group-ID and group-executable mode bits |
| 325 |
enabled; |
| 326 |
and |
| 327 |
.IP \[bu] |
| 328 |
the caller has permission to read and write the target file |
| 329 |
(either via the file's permissions mask |
| 330 |
or because it has suitable capabilities). |
| 331 |
.RE |
| 332 |
.RE |
| 333 |
.IP |
| 334 |
The default value in this file is 0. |
| 335 |
Setting the value to 1 |
| 336 |
prevents a longstanding class of security issues caused by |
| 337 |
hard-link-based time-of-check, time-of-use races, |
| 338 |
most commonly seen in world-writable directories such as |
| 339 |
.IR /tmp . |
| 340 |
The common method of exploiting this flaw |
| 341 |
is to cross privilege boundaries when following a given hard link |
| 342 |
(i.e., a root process follows a hard link created by another user). |
| 343 |
Additionally, on systems without separated partitions, |
| 344 |
this stops unauthorized users from "pinning" vulnerable set-user-ID and |
| 345 |
set-group-ID files against being upgraded by |
| 346 |
the administrator, or linking to special files. |
| 347 |
.TP |
| 348 |
.IR /proc/sys/fs/protected_regular " (since Linux 4.19)" |
| 349 |
The value in this file is/can be set to one of the following: |
| 350 |
.RS |
| 351 |
.TP 4 |
| 352 |
0 |
| 353 |
Writing to regular files is unrestricted. |
| 354 |
.TP |
| 355 |
1 |
| 356 |
Don't allow |
| 357 |
.B O_CREAT |
| 358 |
.BR open (2) |
| 359 |
on regular files that the caller doesn't own in |
| 360 |
world-writable sticky directories, |
| 361 |
unless the regular file is owned by the owner of the directory. |
| 362 |
.TP |
| 363 |
2 |
| 364 |
As for the value 1, |
| 365 |
but the restriction also applies to group-writable sticky directories. |
| 366 |
.RE |
| 367 |
.IP |
| 368 |
The intent of the above protections is similar to |
| 369 |
.IR protected_fifos , |
| 370 |
but allows an application to |
| 371 |
avoid writes to an attacker-controlled regular file, |
| 372 |
where the application expected to create one. |
| 373 |
.TP |
| 374 |
.IR /proc/sys/fs/protected_symlinks " (since Linux 3.6)" |
| 375 |
.\" commit 800179c9b8a1e796e441674776d11cd4c05d61d7 |
| 376 |
When the value in this file is 0, |
| 377 |
no restrictions are placed on following symbolic links |
| 378 |
(i.e., this is the historical behavior before Linux 3.6). |
| 379 |
When the value in this file is 1, symbolic links are followed only |
| 380 |
in the following circumstances: |
| 381 |
.RS |
| 382 |
.IP \[bu] 3 |
| 383 |
the filesystem UID of the process following the link matches |
| 384 |
the owner (UID) of the symbolic link |
| 385 |
(as described in |
| 386 |
.BR credentials (7), |
| 387 |
a process's filesystem UID is normally the same as its effective UID); |
| 388 |
.IP \[bu] |
| 389 |
the link is not in a sticky world-writable directory; |
| 390 |
or |
| 391 |
.IP \[bu] |
| 392 |
the symbolic link and its parent directory have the same owner (UID) |
| 393 |
.RE |
| 394 |
.IP |
| 395 |
A system call that fails to follow a symbolic link |
| 396 |
because of the above restrictions returns the error |
| 397 |
.B EACCES |
| 398 |
in |
| 399 |
.IR errno . |
| 400 |
.IP |
| 401 |
The default value in this file is 0. |
| 402 |
Setting the value to 1 avoids a longstanding class of security issues |
| 403 |
based on time-of-check, time-of-use races when accessing symbolic links. |
| 404 |
.TP |
| 405 |
.IR /proc/sys/fs/suid_dumpable " (since Linux 2.6.13)" |
| 406 |
.\" The following is based on text from Documentation/sysctl/kernel.txt |
| 407 |
The value in this file is assigned to a process's "dumpable" flag |
| 408 |
in the circumstances described in |
| 409 |
.BR prctl (2). |
| 410 |
In effect, |
| 411 |
the value in this file determines whether core dump files are |
| 412 |
produced for set-user-ID or otherwise protected/tainted binaries. |
| 413 |
The "dumpable" setting also affects the ownership of files in a process's |
| 414 |
.IR /proc/ pid |
| 415 |
directory, as described above. |
| 416 |
.IP |
| 417 |
Three different integer values can be specified: |
| 418 |
.RS |
| 419 |
.TP |
| 420 |
.I 0 (default) |
| 421 |
.\" In kernel source: SUID_DUMP_DISABLE |
| 422 |
This provides the traditional (pre-Linux 2.6.13) behavior. |
| 423 |
A core dump will not be produced for a process which has |
| 424 |
changed credentials (by calling |
| 425 |
.BR seteuid (2), |
| 426 |
.BR setgid (2), |
| 427 |
or similar, or by executing a set-user-ID or set-group-ID program) |
| 428 |
or whose binary does not have read permission enabled. |
| 429 |
.TP |
| 430 |
.I 1 (\[dq]debug\[dq]) |
| 431 |
.\" In kernel source: SUID_DUMP_USER |
| 432 |
All processes dump core when possible. |
| 433 |
(Reasons why a process might nevertheless not dump core are described in |
| 434 |
.BR core (5).) |
| 435 |
The core dump is owned by the filesystem user ID of the dumping process |
| 436 |
and no security is applied. |
| 437 |
This is intended for system debugging situations only: |
| 438 |
this mode is insecure because it allows unprivileged users to |
| 439 |
examine the memory contents of privileged processes. |
| 440 |
.TP |
| 441 |
.I 2 (\[dq]suidsafe\[dq]) |
| 442 |
.\" In kernel source: SUID_DUMP_ROOT |
| 443 |
Any binary which normally would not be dumped (see "0" above) |
| 444 |
is dumped readable by root only. |
| 445 |
This allows the user to remove the core dump file but not to read it. |
| 446 |
For security reasons core dumps in this mode will not overwrite one |
| 447 |
another or other files. |
| 448 |
This mode is appropriate when administrators are |
| 449 |
attempting to debug problems in a normal environment. |
| 450 |
.IP |
| 451 |
Additionally, since Linux 3.6, |
| 452 |
.\" 9520628e8ceb69fa9a4aee6b57f22675d9e1b709 |
| 453 |
.I /proc/sys/kernel/core_pattern |
| 454 |
must either be an absolute pathname |
| 455 |
or a pipe command, as detailed in |
| 456 |
.BR core (5). |
| 457 |
Warnings will be written to the kernel log if |
| 458 |
.I core_pattern |
| 459 |
does not follow these rules, and no core dump will be produced. |
| 460 |
.\" 54b501992dd2a839e94e76aa392c392b55080ce8 |
| 461 |
.RE |
| 462 |
.IP |
| 463 |
For details of the effect of a process's "dumpable" setting |
| 464 |
on ptrace access mode checking, see |
| 465 |
.BR ptrace (2). |
| 466 |
.TP |
| 467 |
.I /proc/sys/fs/super\-max |
| 468 |
This file |
| 469 |
controls the maximum number of superblocks, and |
| 470 |
thus the maximum number of mounted filesystems the kernel |
| 471 |
can have. |
| 472 |
You need increase only |
| 473 |
.I super\-max |
| 474 |
if you need to mount more filesystems than the current value in |
| 475 |
.I super\-max |
| 476 |
allows you to. |
| 477 |
.TP |
| 478 |
.I /proc/sys/fs/super\-nr |
| 479 |
This file |
| 480 |
contains the number of filesystems currently mounted. |
| 481 |
.SH SEE ALSO |
| 482 |
.BR proc (5), |
| 483 |
.BR proc_sys (5) |