Saturday, May 26, 2012

understanding Linux configuration files


Every Linux program is an executable file holding the list of opcodes the CPU executes to accomplish specific operations. For instance, the ls command is provided by the file /bin/ls, which holds the list of machine instructions needed to display the list of files in the current directory onto the screen. The behaviour of almost every program can be customized to your preferences or needs by modifying its configuration files.
In a word, no. Users who are new to Linux (rightly) feel frustrated that each configuration file looks like a new challenge to figure out. In Linux each programmer is free to choose the configuration file format he or she prefers. Format options range from the /etc/shells file, which contains a list of possible shells separated by a newline, to Apache's complex /etc/httpd.conf file.
The kernel itself may be considered a "program." Why does the kernel need configuration files? The kernel needs to know the list of users and groups in the system, and manage file permissions (that is, determine if a file can be opened by a specific user, according to the permissions, UNIX_USERS). Note that these files are not specifically read by programs, but by a function provided by a system library, and used by the kernel. For instance, a program needing the (encrypted) password of a user should not open the /etc/passwd file. Instead, it should call the system library function getpw(). This kind of function is also known as a system call. It is up to the kernel (through the system library) to open the /etc/passwd file and after that, search for the password of the requested user.
Most of the configuration files in the Red Hat Linux system are in the /etc directory unless otherwise specified. The configuration files can be broadly classified into the following categories:
/etc/host.confTells the network domain server how to look up hostnames. (Normally /etc/hosts, then name server; it can be changed through netconf.)
/etc/hostsContains a list of known hosts (in the local network). Can be used if the IP of the system is not dynamically generated. For simple hostname resolution (to dotted notation), /etc/hosts.conf normally tells the resolver to look here before asking the network nameserver, DNS or NIS.
/etc/hosts.allowMan page same as hosts_access. Read by tcpd at least.
/etc/hosts.denyMan page same as hosts_access. Read by tcpd at least.
/etc/issue & /etc/issue.netThese files are read by mingetty (and similar programs) to display a "welcome" string to the user connecting from a terminal (issue) or through a telnet session (issue.net). They include a few lines stating the Red Hat release number, name, and Kernel ID. They are used by rc.local.
/etc/redhat-releaseIncludes one line stating the Red Hat release number and name. Used by rc.local.
/etc/rc.d/rcNormally run for all run levels with level passed as argument. For example, to boot your machine in the Graphics mode (X-Server), run the following command from your command line: init 5. The runlevel 5 is starts the system in graphics mode.
/etc/rc.d/rc.localNot official. May be called from rc, rc.sysinit, or /etc/inittab.
/etc/rc.d/rc.sysinitNormally the first script run for all run levels.
/etc/rc.d/rc/rcX.dScripts run from rc (X stands for any number from 1 to 5). These directories are "run-level" specific directories. When a system starts up, it identifies the run-level to be initiated, and then it calls all the startup scripts present in the specific directory for that run-level. For example, the system usually starts up and the message "entering run-level 3" is shown after the boot messages; this means that all the init scripts in the directory /etc/rc.d/rc3.d/ will be called.
The kernel provides an interface to display some of its data structures that can be useful for determining the system parameters like interrupts used, devices initialised, memory statistics, etc. This interface is provided as a separate but dummy filesystem known as the /proc filesystem. Many system utilities use the values present in this filesystemf or displaying the system statistics. For example, the file /proc/modules lists the currently loaded modules in the system. This information is read by the command lsmod, which then displays it in a human readable format. In the same way, the file mtab specified in the following table reads the /proc/mount file, which contains the currently mounted filesystems.
/etc/mtabThis changes continuously as the file /proc/mount changes. In other words, when filesystems are mounted and unmounted, the change is immediately reflected in this file.
/etc/fstabLists the filesystems currently "mountable" by the computer. This is important because when the computer boots, it runs the command mount -a, which takes care of mounting every file system marked with a "1" in the next-to-last column of fstab.
/etc/mtools.confConfiguration for all the operations (mkdir, copy, format, etc.) on a DOS-type filesystem.
/etc/groupContains the valid group names and the users included in the specified groups. A single user can be present in more than one group if he performs multiple tasks. For example, is a "user" is the administrator as well as a member of the project group "project 1", then his entry in the group file will look like: user: * : group-id : project1
/etc/nologinIf the file /etc/nologin exists, login(1) will allow access only to root. Other users will be shown the contents of this file and their logins refused.
etc/passwdSee "man passwd". Holds some user account info including passwords (when not "shadowed").
/etc/rpmrcrpm command configuration. All the rpm command line options can be set together in this file so that all of the options apply globally when any rpm command is run on that system.
/etc/securettyContains the device names of tty lines (one per line, without leading /dev/) on which root is allowed to login.
/etc/usertty
/etc/shadow
Contains the encrypted password information for users' accounts and optionally the password aging information. Included fields are:
  • Login name
  • Encrypted password
  • Days since Jan 1, 1970 that password was last changed
  • Days before password may be changed
  • Days after which password must be changed
  • Days before password is to expire that user is warned
  • Days after password expires that account is disabled
  • Days since Jan 1, 1970 that account is disabled
/etc/shellsHolds the list of possible "shells" available to the system.
/etc/motdMessage Of The Day; used if an administrator wants to convey some message to all the users of a Linux server.
/etc/gated.confConfiguration for gated. Used only by the gated daemon.
/etc/gated.versionContains the version number of the gated daemon.
/etc/gatewayOptionally used by the routed daemon.
/etc/networksLists names and addresses of networks accessible from the network to which the machine is connected. Used by route command. Allows use of name for network.
/etc/protocolsLists the currently available protocols. See the NAG (Network Administrators Guide) and man page.
C interface is getprotoent. Should never change.
/etc/resolv.confTells the kernel which name server should be queried when a program asks to "resolve" an IP Address.
/etc/rpcContains instructions/rules for RPC, which can be used in NFS calls, remote file system mounting, etc.
/etc/exportsThe file system to be exported (NFS) and permissions for it.
/etc/servicesTranslates network service names to port number/protocol. Read by inetd, telnet, tcpdump, and some other programs. There are C access routines.
/etc/inetd.confConfig file for inetd. See the inetd man page. Holds an entry for each network service for which inetd must control daemons or other servicers. Note that services will be running, but comment them out in /etc/services so they will not be available even if running. Format:
/etc/sendmail.cfThe Mail program sendmail's configuration file. Cryptic to understand.
/etc/sysconfig/networkIndicates NETWORKING=yes or no. Read by rc.sysinit at least.
/etc/sysconfig/network-scripts/if*Red Hat network configuration scripts.
System commands are meant exclusively to control the system, and make everything work properly. All the programs like login (performing the authentication phase of a user on the console) or bash (providing the interaction between a user and the computer) are system commands. The files associated with them are therefore particularly important. This category has the following files of interest to users and administrators.
/etc/lilo.confContains the system's default boot command line parameters and also the different images to boot with. You can see this list by pressing Tab at the LILO prompt.
/etc/logrotate.confMaintains the log files present in the /var/log directory.
/etc/identd.confIdentd is a server that implements the TCP/IP proposed standard IDENT user identification protocol as specified in the RFC 1413 document. identd operates by looking up specific TCP/IP connections and returning the user name of the process owning the connection. It can optionally return other information instead of a user name. See the identd man page.
/etc/ld.so.confConfiguration for the Dynamic Linker.
/etc/inittabThis is chronologically the first configuration file in UNIX. The first program launched after a UNIX machine is switched on is init, which knows what to launch, thanks to inittab. It is read by init at run level changes, and controls the startup of the main process.
/etc/termcapA database containing all of the possible terminal types and their capabilities.
A daemon is a program running in non-interactive mode. Typically, daemon tasks are related to the networking area: they wait for connections, so that they can provide services through them. Many daemons are available for Linux, ranging from Web servers to ftp servers.
/etc/syslogd.confThe configuration file for the syslogd daemon. syslogd is the daemon that takes care of logging (writing to disk) messages coming from other programs to the system. This service, in particular, is used by daemons that would not otherwise have any means of signaling the presence of possible problems or sending messages to users.

/etc/httpd.conf
The configuration file for Apache, the Web server. This file is typically not in /etc. It may be in /usr/local/httpd/conf/ or /etc/httpd/conf/, but to make sure, you need to check the particular Apache installation.
/etc/conf.modules or /etc/modules.confThe configuration file for kerneld. Ironically, it is not the kernel "as a daemon". It is rather a daemon that takes care of loading additional kernel modules "on the fly" when needed.
In Linux (and UNIX in general), there are countless "user" programs. A most common user program config file is /etc/lynx.cfg. This is the configuration file for lynx, the well-known textual browser. Through this file you can define the proxy server, the character set to use, and so on. The following code sample shows a part of the lynx.cfg file that can be modified to change the proxy settings of the Linux system. These settings apply (by default) to all the users running lynx in their respective shells, unless a user overrides the default config file by specifying --cfg = "mylynx.cfg.

Proxy settings in /etc/lynx.cfg 
.h1 proxy
.h2 HTTP_PROXY
.h2 HTTPS_PROXY
.h2 FTP_PROXY
.h2 GOPHER_PROXY
.h2 NEWS_PROXY
.h2 NNTP_PROXY
# Lynx version 2.2 and beyond supports the use of proxy servers that can act as
# firewall gateways and caching servers. They are preferable to the older
# gateway servers. Each protocol used by Lynx can be mapped separately using
# PROTOCOL_proxy environment variables (see Lynx Users Guide). If you have 
# not set them externally, you can set them at run time via this configuration file.
# They will not override external settings. The no_proxy variable can be used
# to inhibit proxying to selected regions of the Web (see below). Note that on
# VMS these proxy variables are set as process logicals rather than symbols, to
# preserve lowercasing, and will outlive the Lynx image.
#
.ex 15
http_proxy:http://proxy3.in.ibm.com:80/
ftp_proxy:http://proxy3.in.ibm.com:80/
#http_proxy:http://penguin.in.ibm.com:8080
#ftp_proxy:http://penguin.in.ibm.com:8080/

.h2 NO_PROXY
# The no_proxy variable can be a comma-separated list of strings defining
# no-proxy zones in the DNS domain name space.  If a tail substring of the
# domain-path for a host matches one of these strings, transactions with that
# node will not be proxied.
.ex
no_proxy:demiurge.in.ibm.com, demiurge


When changing a configuration file, make sure that the program using that configuration is restarted if it's not controlled by the system administrator or the kernel. A normal user doesn't usually have privileges to start or stop system programs and/or daemons.
Changing configuration files in the kernel immediately affects the system. For example, changing the passwd file to add a user immediately enables that user. Also there are some kernel tunable parameters in the /proc/sys directory on any Linux system. The write-access to all these files is given only to the super-user; other users have only readonly access. The files in this directory are classified in the same manner as the Linux kernel source. Every file in this directory represents a kernel data structure that can be dynamically modified to change the system performance.
Note: Before changing any value in any of these files, make sure you know everything about the file to avoid irreparable damage to the system.
Files in the /proc/sys/kernel/ directory
File nameDescription
threads-maxThe maximum number of tasks the kernel can run.
ctrl-alt-delIf 1, then pressing this key sequence cleanly reboots the system.
sysrqIf 1, then Alt-SysRq is active.
osreleaseDisplays the release of the operating system.
ostypeDisplays the type of the operating system.
hostnameThe host name of the system.
domainnameNetwork domain of which the system is a part.
modprobeSpecifies whether modprobe should be automatically run at startup, and load the necessary modules.
A daemon is a program that is always running in background, quietly carrying out its task. Common ones are in.ftpd (ftp server daemon), in.telnetd (telnet server daemon), and syslogd (system logging daemon). Some daemons, while running, keep a close watch on the configuration file and reload it automatically when it changes. But most of the daemons do not reload automatically. We need to "tell" them somehow that the configuration file has changed and that it should be reloaded. This can be achieved (on Red Hat Linux systems) by restarting the services using the service command.
For example, if we have changed the network configuration, we need to issue:
service network restart.
Note: The services are most commonly the scripts present in the /etc/rc.d/init.d/* directory and are started by the init when the system is booted. So, to restart the service you can also do the following:
/etc/rc.d/init.d/ start | stop | status
start, stop, and status are the values that these scripts take as input to perform the action.
A user or system program reads its configuration file every time it is launched. Remember, though, that some system programs are spawned when the computer is turned on, and their behaviour depends on what they read in the configuration files in /etc/. So, the first time a user program is started, the default configuration is read from the files present in the /etc/ directory. Later, the user can customise the programs by using rc and . (dot) files as explained in the next section.
We have seen how programs can be easily configured. But what if someone does not like the way a program has been configured in /etc/? A "normal" user cannot simply go into /etc and change the configuration files; they are owned -- from the filesystem's point of view -- by root! This is why most user programs define two configuration files: the first one at a "system" level, located in /etc/; and the other one, "private" to the user, that can be found in his or her home directory.
For example, in my system I have installed the very useful wget utility. In /etc/ there is an /etc/wgetrc file. In my home directory, there is a file named .wgetrc, which describes my customised configuration (which will be loaded only when I, the user run the wget command). Other users may also have the .wgetrc file in their home directory (/home/other); this file will be read, of course, only when the user runs the wget command. In other words, the /etc/wgetrc file provides "default" values for wget, while the /home/xxx/.wgetrc file lists the "customisations" for a certain user. It is important to understand that this is the "general rule," and is not necessarily true for all cases. A program like pine, for instance, does not have any files in /etc/, but only the custom configuration in the users' home directory, in a file named .pinerc. Other programs may only have a default configuration file in /etc/, and may not let users "customize" them (it's the case with only a few of the config. files in the /etc dir.).

Commonly used rc and . (dot) files
FilenameDescription
~/.bash_loginLook at "man bash". Treated by bash like ~/.bash_profile if that doesn't exist.
~/.bash_logoutLook at "man bash".Sourced by bash login shells at exit.
~/.bash_profileSourced by bash login shells after /etc/profile.
~/.bash_historyThe list of commands executed previously.
~/.bashrc Look at "man bash". Sourced by bash non-login interactive shells (no other files are). Non-interactive shells source nothing unless BASH_ENV or ENV are set.
~/.emacsRead by emacs at startup.
~/.forward If this contains an e-mail address, then all mail to owner of ~ will be forwarded to that e-mail address.
~/.fvwmrc ~/.fvwm2rcConfig files for fvwm and fvwm2 (the basic X Window manager).
~/.hushloginLook at "man login". Causes a "quiet" login (no mail notice, last login info, or MOD).
~/.mail.rcUser init file for mail program.
~/.ncftp/Directory for ncftp program; contains bookmarks, log, macros, preferences, trace. See man ncftp. The purpose of ncftp is to provide a powerful and flexible interface to the Internet standard File Transfer Protocol. It is intended to replace the stock ftp program that comes with the system.
~/.profileLook at "man bash". Treated by bash like ~/.bash_profile if that and ~/.bash_login don't exist, and used by other Bourn-heritage shells too.
~/.pinercPine configuration
~/.muttrcMutt configuration
~/.exrcConfiguration of vi can be controlled by this file.
Example: set ai sm ruler
Writing the above line in this file makes vi set the auto-indentation, matching brackets and displaying line number and rows-columns options.
~/.vimrcDefault "Vim" configuration file. Same as .exrc.
~/.gtkrcGNOME Toolkit.
~/.kdercKDE configuration.
~/.netrcDefault login names and passwords for ftp.
~/.rhostsUsed by the r-tools: rsh, rlogin, etc. Very weak security since host impersonation is easy.
  1. Must be owned by user (owner of ~/) or superuser.
  2. Lists hosts from which users may access this account.
  3. Ignored if it is a symbolic link.
~/.rpmrcSee "man rpm". Read by rpm if /etc/rpmrc is not present.
~/.signatureMessage text that will be appended automatically to the mail sent from this account.
~/.twmrcConfig file for twm (The Window Manager).
~/.xinitrcRead by X at startup (not by xinit script). Mostly starts some progs.
Example: exec /usr/sbin/startkde
If the above line is present in this file, then the KDE Window Manager is started in when the startx command is issued from this account.
~/.xmodmaprcThis file is passed to the xmodmap program, and could be named anything (~/.Xmodmap and ~/.keymap.km, for example).
~/.xserverrcRun by xinit as the X server if it can find X to execute.
~/News/Sent-Message-IDsDefault mail history file for gnus.
~/.XauthorityRead and written by xdm program to handle authorization. See the X, xdm, and xauth man pages.
~/.Xdefaults,
~/.Xdefaults-hostname
Read by X applications during startup on hostname. If the -hostname file can't be found, .Xdefaults is looked for.
~/.XmodmapPoints to .xmodmaprc; Red Hat had (has) .xinitrc using this name.
~/.XresourcesUsually the name for the file passed to xrdb to load the X resources database, to avoid the need for applications to read a long .Xdefaults file. (~/.Xres has been used by some.)

~/mbox

User's old mail.

Understanding Linux Kernel Parameters


1 Documentation for /proc/sys/kernel/* kernel version 2.2.10
2  (c) 1998, 1999,  Rik van Riel 
3  (c) 2009,        Shen Feng
4 
5 For general info and legal blurb, please look in README.
6 
7 ==============================================================
8 
9 This file contains documentation for the sysctl files in
10 /proc/sys/kernel/ and is valid for Linux kernel version 2.2.
11 
12 The files in this directory can be used to tune and monitor
13 miscellaneous and general things in the operation of the Linux
14 kernel. Since some of the files _can_ be used to screw up your
15 system, it is advisable to read both documentation and source
16 before actually making adjustments.
17 
18 Currently, these files might (depending on your configuration)
19 show up in /proc/sys/kernel:
20 
21 - acct
22 - acpi_video_flags
23 - auto_msgmni
24 - bootloader_type      [ X86 only ]
25 - bootloader_version      [ X86 only ]
26 - callhome       [ S390 only ]
27 - cap_last_cap
28 - core_pattern
29 - core_pipe_limit
30 - core_uses_pid
31 - ctrl-alt-del
32 - dmesg_restrict
33 - domainname
34 - hostname
35 - hotplug
36 - kptr_restrict
37 - kstack_depth_to_print       [ X86 only ]
38 - l2cr                        [ PPC only ]
39 - modprobe                    ==> Documentation/debugging-modules.txt
40 - modules_disabled
41 - msgmax
42 - msgmnb
43 - msgmni
44 - nmi_watchdog
45 - osrelease
46 - ostype
47 - overflowgid
48 - overflowuid
49 - panic
50 - panic_on_oops
51 - panic_on_unrecovered_nmi
52 - panic_on_stackoverflow
53 - pid_max
54 - powersave-nap               [ PPC only ]
55 - printk
56 - printk_delay
57 - printk_ratelimit
58 - printk_ratelimit_burst
59 - randomize_va_space
60 - real-root-dev               ==> Documentation/initrd.txt
61 - reboot-cmd                  [ SPARC only ]
62 - rtsig-max
63 - rtsig-nr
64 - sem
65 - sg-big-buff                 [ generic SCSI device (sg) ]
66 - shm_rmid_forced
67 - shmall
68 - shmmax                      [ sysv ipc ]
69 - shmmni
70 - softlockup_thresh
71 - stop-a                      [ SPARC only ]
72 - sysrq                       ==> Documentation/sysrq.txt
73 - tainted
74 - threads-max
75 - unknown_nmi_panic
76 - version
77 
78 ==============================================================
79 
80 acct:
81 
82 highwater lowwater frequency
83 
84 If BSD-style process accounting is enabled these values control
85 its behaviour. If free space on filesystem where the log lives
86 goes below % accounting suspends. If free space gets
87 above % accounting resumes.  determines
88 how often do we check the amount of free space (value is in
89 seconds). Default:
90 4 2 30
91 That is, suspend accounting if there left <= 2% free; resume it
92 if we got >=4%; consider information about amount of free space
93 valid for 30 seconds.
94 
95 ==============================================================
96 
97 acpi_video_flags:
98 
99 flags
100 
101 See Doc*/kernel/power/video.txt, it allows mode of video boot to be
102 set during run time.
103 
104 ==============================================================
105 
106 auto_msgmni:
107 
108 Enables/Disables automatic recomputing of msgmni upon memory add/remove
109 or upon ipc namespace creation/removal (see the msgmni description
110 above). Echoing "1" into this file enables msgmni automatic recomputing.
111 Echoing "0" turns it off. auto_msgmni default value is 1.
112 
113 
114 ==============================================================
115 
116 bootloader_type:
117 
118 x86 bootloader identification
119 
120 This gives the bootloader type number as indicated by the bootloader,
121 shifted left by 4, and OR'd with the low four bits of the bootloader
122 version.  The reason for this encoding is that this used to match the
123 type_of_loader field in the kernel header; the encoding is kept for
124 backwards compatibility.  That is, if the full bootloader type number
125 is 0x15 and the full version number is 0x234, this file will contain
126 the value 340 = 0x154.
127 
128 See the type_of_loader and ext_loader_type fields in
129 Documentation/x86/boot.txt for additional information.
130 
131 ==============================================================
132 
133 bootloader_version:
134 
135 x86 bootloader version
136 
137 The complete bootloader version number.  In the example above, this
138 file will contain the value 564 = 0x234.
139 
140 See the type_of_loader and ext_loader_ver fields in
141 Documentation/x86/boot.txt for additional information.
142 
143 ==============================================================
144 
145 callhome:
146 
147 Controls the kernel's callhome behavior in case of a kernel panic.
148 
149 The s390 hardware allows an operating system to send a notification
150 to a service organization (callhome) in case of an operating system panic.
151 
152 When the value in this file is 0 (which is the default behavior)
153 nothing happens in case of a kernel panic. If this value is set to "1"
154 the complete kernel oops message is send to the IBM customer service
155 organization in case the mainframe the Linux operating system is running
156 on has a service contract with IBM.
157 
158 ==============================================================
159 
160 cap_last_cap
161 
162 Highest valid capability of the running kernel.  Exports
163 CAP_LAST_CAP from the kernel.
164 
165 ==============================================================
166 
167 core_pattern:
168 
169 core_pattern is used to specify a core dumpfile pattern name.
170 . max length 128 characters; default value is "core"
171 . core_pattern is used as a pattern template for the output filename;
172   certain string patterns (beginning with '%') are substituted with
173   their actual values.
174 . backward compatibility with core_uses_pid:
175  If core_pattern does not include "%p" (default does not)
176  and core_uses_pid is set, then .PID will be appended to
177  the filename.
178 . corename format specifiers:
179  % '%' is dropped
180  %% output one '%'
181  %p pid
182  %u uid
183  %g gid
184  %s signal number
185  %t UNIX time of dump
186  %h hostname
187  %e executable filename (may be shortened)
188  %E executable path
189  % both are dropped
190 . If the first character of the pattern is a '|', the kernel will treat
191   the rest of the pattern as a command to run.  The core dump will be
192   written to the standard input of that program instead of to a file.
193 
194 ==============================================================
195 
196 core_pipe_limit:
197 
198 This sysctl is only applicable when core_pattern is configured to pipe
199 core files to a user space helper (when the first character of
200 core_pattern is a '|', see above).  When collecting cores via a pipe
201 to an application, it is occasionally useful for the collecting
202 application to gather data about the crashing process from its
203 /proc/pid directory.  In order to do this safely, the kernel must wait
204 for the collecting process to exit, so as not to remove the crashing
205 processes proc files prematurely.  This in turn creates the
206 possibility that a misbehaving userspace collecting process can block
207 the reaping of a crashed process simply by never exiting.  This sysctl
208 defends against that.  It defines how many concurrent crashing
209 processes may be piped to user space applications in parallel.  If
210 this value is exceeded, then those crashing processes above that value
211 are noted via the kernel log and their cores are skipped.  0 is a
212 special value, indicating that unlimited processes may be captured in
213 parallel, but that no waiting will take place (i.e. the collecting
214 process is not guaranteed access to /proc//).  This
215 value defaults to 0.
216 
217 ==============================================================
218 
219 core_uses_pid:
220 
221 The default coredump filename is "core".  By setting
222 core_uses_pid to 1, the coredump filename becomes core.PID.
223 If core_pattern does not include "%p" (default does not)
224 and core_uses_pid is set, then .PID will be appended to
225 the filename.
226 
227 ==============================================================
228 
229 ctrl-alt-del:
230 
231 When the value in this file is 0, ctrl-alt-del is trapped and
232 sent to the init(1) program to handle a graceful restart.
233 When, however, the value is > 0, Linux's reaction to a Vulcan
234 Nerve Pinch (tm) will be an immediate reboot, without even
235 syncing its dirty buffers.
236 
237 Note: when a program (like dosemu) has the keyboard in 'raw'
238 mode, the ctrl-alt-del is intercepted by the program before it
239 ever reaches the kernel tty layer, and it's up to the program
240 to decide what to do with it.
241 
242 ==============================================================
243 
244 dmesg_restrict:
245 
246 This toggle indicates whether unprivileged users are prevented
247 from using dmesg(8) to view messages from the kernel's log buffer.
248 When dmesg_restrict is set to (0) there are no restrictions. When
249 dmesg_restrict is set set to (1), users must have CAP_SYSLOG to use
250 dmesg(8).
251 
252 The kernel config option CONFIG_SECURITY_DMESG_RESTRICT sets the
253 default value of dmesg_restrict.
254 
255 ==============================================================
256 
257 domainname & hostname:
258 
259 These files can be used to set the NIS/YP domainname and the
260 hostname of your box in exactly the same way as the commands
261 domainname and hostname, i.e.:
262 # echo "darkstar" > /proc/sys/kernel/hostname
263 # echo "mydomain" > /proc/sys/kernel/domainname
264 has the same effect as
265 # hostname "darkstar"
266 # domainname "mydomain"
267 
268 Note, however, that the classic darkstar.frop.org has the
269 hostname "darkstar" and DNS (Internet Domain Name Server)
270 domainname "frop.org", not to be confused with the NIS (Network
271 Information Service) or YP (Yellow Pages) domainname. These two
272 domain names are in general different. For a detailed discussion
273 see the hostname(1) man page.
274 
275 ==============================================================
276 
277 hotplug:
278 
279 Path for the hotplug policy agent.
280 Default value is "/sbin/hotplug".
281 
282 ==============================================================
283 
284 kptr_restrict:
285 
286 This toggle indicates whether restrictions are placed on
287 exposing kernel addresses via /proc and other interfaces.  When
288 kptr_restrict is set to (0), there are no restrictions.  When
289 kptr_restrict is set to (1), the default, kernel pointers
290 printed using the %pK format specifier will be replaced with 0's
291 unless the user has CAP_SYSLOG.  When kptr_restrict is set to
292 (2), kernel pointers printed using %pK will be replaced with 0's
293 regardless of privileges.
294 
295 ==============================================================
296 
297 kstack_depth_to_print: (X86 only)
298 
299 Controls the number of words to print when dumping the raw
300 kernel stack.
301 
302 ==============================================================
303 
304 l2cr: (PPC only)
305 
306 This flag controls the L2 cache of G3 processor boards. If
307 0, the cache is disabled. Enabled if nonzero.
308 
309 ==============================================================
310 
311 modules_disabled:
312 
313 A toggle value indicating if modules are allowed to be loaded
314 in an otherwise modular kernel.  This toggle defaults to off
315 (0), but can be set true (1).  Once true, modules can be
316 neither loaded nor unloaded, and the toggle cannot be set back
317 to false.
318 
319 ==============================================================
320 
321 nmi_watchdog:
322 
323 Enables/Disables the NMI watchdog on x86 systems. When the value is
324 non-zero the NMI watchdog is enabled and will continuously test all
325 online cpus to determine whether or not they are still functioning
326 properly. Currently, passing "nmi_watchdog=" parameter at boot time is
327 required for this function to work.
328 
329 If LAPIC NMI watchdog method is in use (nmi_watchdog=2 kernel
330 parameter), the NMI watchdog shares registers with oprofile. By
331 disabling the NMI watchdog, oprofile may have more registers to
332 utilize.
333 
334 ==============================================================
335 
336 osrelease, ostype & version:
337 
338 # cat osrelease
339 2.1.88
340 # cat ostype
341 Linux
342 # cat version
343 #5 Wed Feb 25 21:49:24 MET 1998
344 
345 The files osrelease and ostype should be clear enough. Version
346 needs a little more clarification however. The '#5' means that
347 this is the fifth kernel built from this source base and the
348 date behind it indicates the time the kernel was built.
349 The only way to tune these values is to rebuild the kernel :-)
350 
351 ==============================================================
352 
353 overflowgid & overflowuid:
354 
355 if your architecture did not always support 32-bit UIDs (i.e. arm,
356 i386, m68k, sh, and sparc32), a fixed UID and GID will be returned to
357 applications that use the old 16-bit UID/GID system calls, if the
358 actual UID or GID would exceed 65535.
359 
360 These sysctls allow you to change the value of the fixed UID and GID.
361 The default is 65534.
362 
363 ==============================================================
364 
365 panic:
366 
367 The value in this file represents the number of seconds the kernel
368 waits before rebooting on a panic. When you use the software watchdog,
369 the recommended setting is 60.
370 
371 ==============================================================
372 
373 panic_on_unrecovered_nmi:
374 
375 The default Linux behaviour on an NMI of either memory or unknown is
376 to continue operation. For many environments such as scientific
377 computing it is preferable that the box is taken out and the error
378 dealt with than an uncorrected parity/ECC error get propagated.
379 
380 A small number of systems do generate NMI's for bizarre random reasons
381 such as power management so the default is off. That sysctl works like
382 the existing panic controls already in that directory.
383 
384 ==============================================================
385 
386 panic_on_oops:
387 
388 Controls the kernel's behaviour when an oops or BUG is encountered.
389 
390 0: try to continue operation
391 
392 1: panic immediately.  If the `panic' sysctl is also non-zero then the
393    machine will be rebooted.
394 
395 ==============================================================
396 
397 panic_on_stackoverflow:
398 
399 Controls the kernel's behavior when detecting the overflows of
400 kernel, IRQ and exception stacks except a user stack.
401 This file shows up if CONFIG_DEBUG_STACKOVERFLOW is enabled.
402 
403 0: try to continue operation.
404 
405 1: panic immediately.
406 
407 ==============================================================
408 
409 
410 pid_max:
411 
412 PID allocation wrap value.  When the kernel's next PID value
413 reaches this value, it wraps back to a minimum PID value.
414 PIDs of value pid_max or larger are not allocated.
415 
416 ==============================================================
417 
418 ns_last_pid:
419 
420 The last pid allocated in the current (the one task using this sysctl
421 lives in) pid namespace. When selecting a pid for a next task on fork
422 kernel tries to allocate a number starting from this one.
423 
424 ==============================================================
425 
426 powersave-nap: (PPC only)
427 
428 If set, Linux-PPC will use the 'nap' mode of powersaving,
429 otherwise the 'doze' mode will be used.
430 
431 ==============================================================
432 
433 printk:
434 
435 The four values in printk denote: console_loglevel,
436 default_message_loglevel, minimum_console_loglevel and
437 default_console_loglevel respectively.
438 
439 These values influence printk() behavior when printing or
440 logging error messages. See 'man 2 syslog' for more info on
441 the different loglevels.
442 
443 - console_loglevel: messages with a higher priority than
444   this will be printed to the console
445 - default_message_loglevel: messages without an explicit priority
446   will be printed with this priority
447 - minimum_console_loglevel: minimum (highest) value to which
448   console_loglevel can be set
449 - default_console_loglevel: default value for console_loglevel
450 
451 ==============================================================
452 
453 printk_delay:
454 
455 Delay each printk message in printk_delay milliseconds
456 
457 Value from 0 - 10000 is allowed.
458 
459 ==============================================================
460 
461 printk_ratelimit:
462 
463 Some warning messages are rate limited. printk_ratelimit specifies
464 the minimum length of time between these messages (in jiffies), by
465 default we allow one every 5 seconds.
466 
467 A value of 0 will disable rate limiting.
468 
469 ==============================================================
470 
471 printk_ratelimit_burst:
472 
473 While long term we enforce one message per printk_ratelimit
474 seconds, we do allow a burst of messages to pass through.
475 printk_ratelimit_burst specifies the number of messages we can
476 send before ratelimiting kicks in.
477 
478 ==============================================================
479 
480 randomize_va_space:
481 
482 This option can be used to select the type of process address
483 space randomization that is used in the system, for architectures
484 that support this feature.
485 
486 0 - Turn the process address space randomization off.  This is the
487     default for architectures that do not support this feature anyways,
488     and kernels that are booted with the "norandmaps" parameter.
489 
490 1 - Make the addresses of mmap base, stack and VDSO page randomized.
491     This, among other things, implies that shared libraries will be
492     loaded to random addresses.  Also for PIE-linked binaries, the
493     location of code start is randomized.  This is the default if the
494     CONFIG_COMPAT_BRK option is enabled.
495 
496 2 - Additionally enable heap randomization.  This is the default if
497     CONFIG_COMPAT_BRK is disabled.
498 
499     There are a few legacy applications out there (such as some ancient
500     versions of libc.so.5 from 1996) that assume that brk area starts
501     just after the end of the code+bss.  These applications break when
502     start of the brk area is randomized.  There are however no known
503     non-legacy applications that would be broken this way, so for most
504     systems it is safe to choose full randomization.
505 
506     Systems with ancient and/or broken binaries should be configured
507     with CONFIG_COMPAT_BRK enabled, which excludes the heap from process
508     address space randomization.
509 
510 ==============================================================
511 
512 reboot-cmd: (Sparc only)
513 
514 ??? This seems to be a way to give an argument to the Sparc
515 ROM/Flash boot loader. Maybe to tell it what to do after
516 rebooting. ???
517 
518 ==============================================================
519 
520 rtsig-max & rtsig-nr:
521 
522 The file rtsig-max can be used to tune the maximum number
523 of POSIX realtime (queued) signals that can be outstanding
524 in the system.
525 
526 rtsig-nr shows the number of RT signals currently queued.
527 
528 ==============================================================
529 
530 sg-big-buff:
531 
532 This file shows the size of the generic SCSI (sg) buffer.
533 You can't tune it just yet, but you could change it on
534 compile time by editing include/scsi/sg.h and changing
535 the value of SG_BIG_BUFF.
536 
537 There shouldn't be any reason to change this value. If
538 you can come up with one, you probably know what you
539 are doing anyway :)
540 
541 ==============================================================
542 
543 shmmax:
544 
545 This value can be used to query and set the run time limit
546 on the maximum shared memory segment size that can be created.
547 Shared memory segments up to 1Gb are now supported in the
548 kernel.  This value defaults to SHMMAX.
549 
550 ==============================================================
551 
552 shm_rmid_forced:
553 
554 Linux lets you set resource limits, including how much memory one
555 process can consume, via setrlimit(2).  Unfortunately, shared memory
556 segments are allowed to exist without association with any process, and
557 thus might not be counted against any resource limits.  If enabled,
558 shared memory segments are automatically destroyed when their attach
559 count becomes zero after a detach or a process termination.  It will
560 also destroy segments that were created, but never attached to, on exit
561 from the process.  The only use left for IPC_RMID is to immediately
562 destroy an unattached segment.  Of course, this breaks the way things are
563 defined, so some applications might stop working.  Note that this
564 feature will do you no good unless you also configure your resource
565 limits (in particular, RLIMIT_AS and RLIMIT_NPROC).  Most systems don't
566 need this.
567 
568 Note that if you change this from 0 to 1, already created segments
569 without users and with a dead originative process will be destroyed.
570 
571 ==============================================================
572 
573 softlockup_thresh:
574 
575 This value can be used to lower the softlockup tolerance threshold.  The
576 default threshold is 60 seconds.  If a cpu is locked up for 60 seconds,
577 the kernel complains.  Valid values are 1-60 seconds.  Setting this
578 tunable to zero will disable the softlockup detection altogether.
579 
580 ==============================================================
581 
582 tainted:
583 
584 Non-zero if the kernel has been tainted.  Numeric values, which
585 can be ORed together:
586 
587    1 - A module with a non-GPL license has been loaded, this
588        includes modules with no license.
589        Set by modutils >= 2.4.9 and module-init-tools.
590    2 - A module was force loaded by insmod -f.
591        Set by modutils >= 2.4.9 and module-init-tools.
592    4 - Unsafe SMP processors: SMP with CPUs not designed for SMP.
593    8 - A module was forcibly unloaded from the system by rmmod -f.
594   16 - A hardware machine check error occurred on the system.
595   32 - A bad page was discovered on the system.
596   64 - The user has asked that the system be marked "tainted".  This
597        could be because they are running software that directly modifies
598        the hardware, or for other reasons.
599  128 - The system has died.
600  256 - The ACPI DSDT has been overridden with one supplied by the user
601         instead of using the one provided by the hardware.
602  512 - A kernel warning has occurred.
603 1024 - A module from drivers/staging was loaded.
604 2048 - The system is working around a severe firmware bug.
605 4096 - An out-of-tree module has been loaded.
606 
607 ==============================================================
608 
609 unknown_nmi_panic:
610 
611 The value in this file affects behavior of handling NMI. When the
612 value is non-zero, unknown NMI is trapped and then panic occurs. At
613 that time, kernel debugging information is displayed on console.
614 
615 NMI switch that most IA32 servers have fires unknown NMI up, for
616 example.  If a system hangs up, try pressing the NMI switch.