Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Nov 132010
 

Display the current hard limit of my Linux server

Answer:

The hard limit of your Linux operating system is the maximum server limit that can be set without tuning the kernel parameters in proc file system.

To show it, you can use the ulimit command:

#  ulimit -aH

core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 20
file size               (blocks, -f) unlimited
pending signals                 (-i) 16382
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) unlimited
cpu time               (seconds, -t) unlimited
max user processes              (-u) unlimited
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
Jan 112010
 

Increase the maximum number of open files / file descriptors

Answer:

If you are root, execute the command below

ulimit -SHn 65535

If you want to set it permanently, especially for a particular user, change the file /etc/security/limits.conf to have the following lines (assume user = www-data)

E.g.

www-data hard nofile 65535
www-data soft nofile 65535

And make sure uncomment pam_limits.so from the different files under /etc/pam.d, e.g. sudo, login, sshd, ...

Finally restart your system.