Sysctl

From LQWiki
Jump to navigation Jump to search

sysctl is a program to configure Linux's kernel parameters at runtime. Its basically a wrapper interface to /proc/sys/ settings, and as such, requires /proc to exist. This program is commonly used to load kernel parameters at boot time. The file /etc/sysctl.conf stores these parameters for sysctl.

The basic usage of sysctl is as follows: sysctl parameter=value Where parameter is the parameter to change, and value is the new value to set.

Parameters are /proc/sys/ entries. Simply take the filename, chop off the /proc/sys/ part, and change all '/'s to '.'s. For example, to set the /proc/sys/kernel/domainname parameter:

sysctl kernel.domainname=value

/etc/sysctl.conf

This file stores key/value pairs to pass directly to sysctl, usually done first thing during the boot process. Comments start with a '#' or ';'. Example of this file:

 root@localhost># cat /etc/sysctl.conf
 # Disables the magic-sysrq key
 kernel.sysrq = 0
 # When the kernel panics, automatically reboot in 3 seconds
 kernel.panic = 3
 # Allow for more PIDs (cool factor!); may break some programs
 kernel.pid_max = 999999