ulimit 命令

释放双眼,带上耳机,听听看~!

1
2
3
1
2ulimit [-aHS][-c <core文件上限>][-d <数据节区大小>][-f <文件大小>][-m <内存大小>][-n <文件数目>][-p <缓冲区大小>][-s <堆叠大小>][-t <CPU时间>][-u <程序数目>][-v <虚拟内存大小>]
3

参数

  • -a  显示目前资源限制的设定。
  • -c <core文件上限>  设定core文件的最大值,单位为区块。
  • -d <数据节区大小>  程序数据节区的最大值,单位为KB。
  • -f <文件大小>  shell所能建立的最大文件,单位为区块。
  • -H  设定资源的硬性限制,也就是管理员所设下的限制。
  • -m <内存大小>  指定可使用内存的上限,单位为KB。
  • -n <文件数目>  指定同一时间最多可开启的文件数。
  • -p <缓冲区大小>  指定管道缓冲区的大小,单位512字节。
  • -s <堆叠大小>  指定堆叠的上限,单位为KB。
  • -S  设定资源的弹性限制。
  • -t <CPU时间>  指定CPU使用时间的上限,单位为秒。
  • -u <程序数目>  用户最多可开启的程序数目。
  • -v <虚拟内存大小>  指定可使用的虚拟内存上限,单位为KB。

[root@235 ~]# ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 64112
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 65535
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 32768
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

max user processes:


1
2
3
1
2 Linux itself has a Max Processes per user limit. This feature allows us to control the number of processes an existing user on the server may be authorized to have
3

这个ulimit -u是用来限制每个用户的最大processes数量。如果ulimit -u进行了限制那么每个linux用户可以派生出来的process就会被限制再这个数值之内。

这个参数需要修改 :/etc/security/limits.d/20-nproc.conf

vim /etc/security/limits.d/20-nproc.conf

# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.

*          soft    nproc     4096
root       soft    nproc     unlimited

ulimit 命令

给TA打赏
共{{data.count}}人
人已打赏
安全技术安全运维

Windows服务器如何发现被黑

2018-5-20 12:24:31

安全技术

详解Node.js API系列 Crypto加密模块(2) Hmac

2021-12-21 16:36:11

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索