
我在文件中看到了以下有關type
領域的內容/etc/security/limits.conf
:
-
for enforcing both soft and hard resource limits together.
Note, if you specify a type of '-' but neglect to supply the
item and value fields then the module will never enforce any
limits on the specified user/group etc. .
在手冊頁中我們有這個例子:
* soft core 0
* hard nofile 512
@student hard nproc 20
@faculty soft nproc 20
@faculty hard nproc 50
ftp hard nproc 0
@student - maxlogins 4
此群組的配置@student
具有-
as 類型。在這種情況下,這意味著什麼?
答案1
其他參數是由核心強制執行的進程限制——軟限制是有效的,但用戶(或程式)可以將其提高到硬限制。硬限制不能提高(root 除外),只能降低。因此,有時單獨設定一項或兩者都很有用。
然而,Maxlogins 並不是一個限制——內核本身並沒有追蹤登入。登入限制是由 pam_limits 本身透過計算 utmp 中的(我認為)會話條目來強制執行的。所以它沒有軟/硬之分。