88
Never attempt to tweak your kernel's settings on a production system us-
ing the various files in the /proc/sys directory. Occasionally, chang-
ing a setting may render the kernel unstable, requiring a reboot of the
system. As this would obviously disrupt any users currently using the
system, use a similar development system to try out changes before uti-
lizing them on any production machines.
Before attempting to change a value in /proc/sys, be sure you know
the valid options for that file and the expected outcome.
A good way to determine if a particular file can configured or is only designed to provide information
is to list it. If the file is writable, you may use it to configure the kernel in a certain way. For example,
a partial listing of /proc/sys/fs looks like this:
[root@bleach /]# ls -l /proc/sys/fs
<snip>
-r--r--r--
-rw-r--r--
-r--r--r--
-rw-r--r--
-r--r--r--
<snip>
[root@bleach /]#
In this listing, the files dir-notify-enable and file-max can be written to and, therefore, can
be used to configure the kernel. The other files only provide feedback on the kernel's current settings.
Changing a value within a /proc/sys file is done by echoing the new value into the file. For exam-
ple, to enable the System Request Key on a running kernel, type the command:
[root@bleach /]# echo "1" > /proc/sys/kernel/sysrq
This will change the sysrq file's value from 0 to 1. By default, the System Request Key is enabled
in the Red Hat Linux kernel, but the 0 value is passed to /proc/sys/kernel/sysrq at boot time
by rc.sysinit calling sysctl to pass the /etc/sysctl.conf settings to the kernel via the
/proc directory. This turns off the System Request Key feature, which may cause a security problem
for an unattended console. However, it does permit the root user to enable the feature at any time on
a running kernel, if necessary.
The purpose of the System Request Key is to allow you to immediately instruct the kernel to do a
number of important activities by using a simple key combination, such as immediately shutting down
WARNING
1 root
root
1 root
root
1 root
root
1 root
root
1 root
root
Chapter 4:The /proc Filesystem
0 May 10 16:14 dentry-state
0 May 10 16:14 dir-notify-enable
0 May 10 16:14 dquot-nr
0 May 10 16:14 file-max
0 May 10 16:14 file-nr
Need help?
Do you have a question about the LINUX 7.2 and is the answer not in the manual?
Questions and answers