Monday 6 February 2017

Set ulimits for root user in Linux 6 and Higher

Set ulimits for root user in Linux 6 and Higher

The difference between the hard and soft limits is that the soft limit can be changed as required by the user as long as it no larger than the hard limit which is the maximum setting allowed.

Here is defined a soft and a hard limit. The "soft limit" defines the number of file handles or open files that a user will have after login, the "hard limit" defines the maximum number of file handles (or open files) are possible for the user's shell account. If the  user gets error messages about running out of file handles, then the user can increase the number of file handles like in this example up to the "hard limit" (in this example case 63536) by executing the following command:
ulimit -n 63536

To Check Open Files
 lsof -p
"lsoft -p process_id" - Files open by process id
"lsof -u user" - Files open by user
"lsof -u user -a -i" - Open TCP and UDP sockets for the user.

Steps to set ulimits for root user:

1. Edit /etc/security/limits.d/90-nproc.conf
[root@hrmsdcapp1 security]# vi /etc/security/limits.conf
hrprd              soft    nproc   3072
hrprd              hard    nproc   16384
hrprd              soft    nofile  3072
hrprd              hard    nofile  65536
hrprd              soft    stack   10240


2. Edit /etc/security/limits.d/90-nproc.conf
[root@hrmsdcapp1 limits.d]# vi /etc/security/limits.d/90-nproc.conf
*          soft    nproc     1024
root       soft    nproc     unlimited
#nofile will effect from here for root user
root       soft    nofile    3072
root       hard    nofile    65536

3. Verify the new limits
ulimit -Hn
ulimit -Sn
ulimit -Hu
ulimit -Su

No comments:

Post a Comment

Jenkins Startup and Configuration

Steps to setup jenkins on ubuntu:- -After installation. check the jenkins services running on not on the server. sudo service jenk...