Cent OS下修改用户打开文件数限制

若是有用户test,如今须要修改此用户打开文件数限制,步骤以下:
1 修改Linux下资源使用的配置文件,添加如下参数:vim

sudo vim /etc/security/limits.conf
test soft nproc 65534
test hard nproc 65534
test soft nofile 65534
test hard nofile 65534ide

参数说明:
nproc:用户可用的最大进程数量
nofile:用户可打开的最大文件总数
soft便是软限制,hard是硬限制。用户能够超过soft设置的值,但必定不能超过hard 的值。通常soft比hard小
test:表明用户,能够用 “*” 表示,表明全部用户命令行

2 退出当前Sehll,从新登录,输入下面的命令便可看见参数已经发现改变:进程

[test@localhost ~]$ 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) 1821
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 65534
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) 65534
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimitedip

备注:若是是root用户能够在命令行直接修改,而后把ulimit -SHn 65534追加到/etc/profile文件中,普通用户在yum update升级以后,可能没法在命令行修改,能够直接修改配置文件。资源

相关文章
相关标签/搜索