LIMITS(5)

名称
limits - 资源限制描述

描述

The limits file (/etc/limits by default or LIMITS_FILE defined config.h) describes the resource limits you wish to impose. It should be owned by root and readable by root account only.

By default no quota is imposed on 'root'. In fact, there is no way to impose limits via this procedure to root-equiv accounts (accounts with UID 0).

每行以如下格式对一个用户描述限制：

user LIMITS_STRING

或如下格式：

@group LIMITS_STRING

LIMITS_STRING 是一个串联的资源限制列表。每条限制由一个字母指示符和跟随的数字限制组成。

可用的指示符有：

    • A：最大地址空间 (KB)

    • C：最大转储文件大小 (KB)

    • D：最大数据大小 (KB)

    • F：最大文件尺寸 (KB)

    • K：文件创建掩码，由 umask(2) 设置。

    • I：最高 nice 级别，(0...39 对应 20...-19)

    • L：此用户的最大登录数

    • M: max locked-in-memory address space (KB)

    • N：最大的文件打开数

    • O：最大实时优先级

    • P：进程优先级，由 setpriority(2) 设置。

    • R: max resident set size (KB)

    • S：最大栈尺寸 (KB)

    • T：最大 CPU 时间 (分钟)

    • U：最大处理器数目

例如，L2D2048N5 就是有效的 LIMITS_STRING。为了阅读方便，如下项表示同样的意思：

          username L2D2048N5
          username L2 D2048 N5

Be aware that after username the rest of the line is considered a limit string, thus comments are not allowed. A invalid limits string will be rejected (not considered) by the login program.

The default entry is denoted by username "*". If you have multiple default entries in your LIMITS_FILE, then the last one will be used as the default entry.

The limits specified in the form "@group" apply to the members of the specified group.

If more than one line with limits for an user exist, only the first line for this user will be considered.

If no lines are specified for an user, the last @group line matching a group whose the user is a member of will be considered, or the last line with default limits if no groups contain the user.

要完全禁用对一个用户的限制，可以仅仅只使用一个短线“-”。

To disable a limit for a user, a single dash "-" can be used instead of the numerical value for this limit.

Also, please note that all limit settings are set PER LOGIN. They are not global, nor are they permanent. Perhaps global limits will come, but for now this will have to do ;)

文件

/etc/limits

参见

login(1), setpriority(2), setrlimit(2).