2

I have a CentOS 6.4 server, when i run ulimit -a as root i get this:

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 92905
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 65536
cpu time               (seconds, -t) unlimited
max user processes              (-u) 1024
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

When I run ulimit -a from apache's user, i get this:

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

How can i make sure that all users have the same stack size set?

Edit:

[root@web3 ~]# tail /etc/security/limits.conf
#*               soft    core            0
#*               hard    rss             10000
#@student        hard    nproc           20
#@faculty        soft    nproc           20
#@faculty        hard    nproc           50
#ftp             hard    nproc           0
#@student        -       maxlogins       4
*                -       stack           65536
apache       -   stack       65536
# End of file
[root@web3 ~]#

apache's stack size is still 32768 even though i've changed this setting in /etc/security/limits.conf and rebooted the server.

Itai Ganot
  • 10,644
  • 29
  • 93
  • 146

3 Answers3

0

Not sure why you would like to set the same limits for all users. But I would say an ideal location will be /etc/profile or /etc/bashrc.

StackKrish
  • 370
  • 1
  • 6
  • Well, I could be wrong to want that, I actually just want to set apache's limit to be as root's, you know how it can be done? The apache user doesn't have a home folder. – Itai Ganot Oct 02 '13 at 15:15
0

In CentOS 6.4, the apache user's home directory is /var/www by default. This is also the Apache DocumentRoot. As the apache user's shell is /sbin/nologin however, dropping a shell configuration file in here is not going to be much use.

You can set the limits in /etc/security/limits.conf though, on a per-user or per-group basis and this will allow you to achieve the correct result. In addition, in limits.conf you can set both hard and soft limits, for a more flexible configuration.

Ruairí N.
  • 645
  • 4
  • 8
0

Okay, I found the solution. It seems like it is set by default in the /etc/init.d/httpd file . I manually changed it on each server, restarted httpd and now it's set correctly.

Itai Ganot
  • 10,644
  • 29
  • 93
  • 146