在 Linux 下某用户下能否产生 core 文件,产生的 core file size 的等限制,是可以通过修改配置文件
/etc/security/limits.conf 文件里的配置来加以修改。有的时候,系统会在 /etc/profile 之类的文件中
作出全局的配置。例如: 在 SUSE 下的 /etc/profile 经常有如下的缺省设置:
ulimit -Sc 0 # don't create core files
ulimit -Sd $(ulimit -Hd)
ulimit -Ss $(ulimit -Hs)
ulimit -Sm $(ulimit -Hm)
如果希望产生 core,别忘了把这里的设置注释掉。
按照文件前部的说明,可以在文件中添加类似这样的行:
username soft core scorefilesize
username hard core hcorefilesize
或
@group soft core scorefilesize
@group hard core hcorefilesize
分别对用户'username'和组'groupname'设置能否产生 core,产生的 core file size 的限制
占位符scorefilesize
请详细阅读文件 /etc/security/limits.conf 的注释部分
# /etc/security/limits.conf
#
#Each line describes a limit for a user in the form:
#
#Where:
#
# - an user name
# - a group name, with @group syntax
# - the wildcard *, for default entry
# - the wildcard %, can be also used with %group syntax,
# for maxlogin limit
#
#
# - "soft" for enforcing the soft limits
# - "hard" for enforcing hard limits
#
#
# - core - limits the core file size (KB)
# - data - max data size (KB)
# - fsize - maximum filesize (KB)
# - memlock - max locked-in-memory address space (KB)
# - nofile - max number of open files
# - rss - max resident set size (KB)
# - stack - max stack size (KB)
# - cpu - max CPU time (MIN)
# - nproc - max number of processes
# - as - address space limit
# - maxlogins - max number of logins for this user
# - priority - the priority to run user process with
# - locks - max number of file locks the user can hold
#
#
#
文章来源于领测软件测试网 https://www.ltesting.net/