Wednesday, January 6, 2016

Configuring ulimit in RHEL 6


1. Take backup of conf file: /etc/security/limits.conf

2. Take output of command:
# ulimit -a > /tmp/ulimit

3. Find out what parameter has to set:
[root@rhel5 ~]# 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) 40960
max locked memory    (kbytes, -l) 32
max memory size       (kbytes, -m) unlimited
open files                                  (-n) 5555
pipe size                  (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority                      (-r) 0
stack size                     (kbytes, -s) 10240
cpu time                     (seconds, -t) unlimited
max user processes                  (-u) 40960
virtual memory           (kbytes, -v) unlimited
file locks                                 (-x) unlimited


If "no of open files" has to set, then add these
line in conf file /etc/security/limits.conf:

#@student        -       maxlogins       4
root  soft    nofile  5555
root  hard    nofile  5555
# End of file

Note: Other parameters are mentioned in conf file.

4. To cross check:
# ulimit -n
OR
# ulimit -a

5. Now logout and log back in to take effect.

6. To revert the changes, simply comment the lines in conf files.
Then logout and log back in.

Also, you can configure the same by editing the user's .bashrc file:
Make an entry in .bashrd file of that user's home directory:
# vim .bashrc
ulimit -n 65536


No comments:

Post a Comment