Linux configuration file description

Source: Internet
Author: User
Tags ftp login
The system configuration file kernel itself can also be considered as a "program ". Why does the kernel need a configuration file? The kernel needs to know the list of users and groups in the system, and then manage the file permissions (that is, determine whether a specific user (UNIX_USERS) can open a file based on the permissions ). Note that these files are not explicitly read by the program, but are provided by the system Library. System configuration file
The kernel itself can also be seen as a "program ". Why does the kernel need a configuration file? The kernel needs to know the list of users and groups in the system, and then manage the file permissions (that is, determine whether a specific user (UNIX_USERS) can open a file based on the permissions ). Note that these files are not explicitly read by the program, but are read by a function provided by the system library and used by the kernel. For example, when a program requires a user's (encrypted) password, the/etc/passwd file should not be opened. Instead, the program should call the getpw () function of the system Library. This type of function is also called by the system. To open the/etc/passwd file and then find the password of the requested user is determined by the kernel (through the system Library.
Unless otherwise specified, most configuration files in Red Hat Linux are in the/etc directory. Configuration files can be roughly divided into the following categories:

Access files

/Etc/host. conf tells the network domain name server how to find the host name. (Usually/etc/hosts, and then the name server; you can change it through netconf)
/Etc/hosts contains a list of known hosts in the local network. If the system IP address is not dynamically generated, you can use it. For simple host name resolution (dot-based representation), before requesting a DNS or NIS network name server,/etc/hosts. conf usually tells the DNS program to check the domain name first.
For details about/etc/hosts. allow, refer to the online help page of hosts_access. Read by tcpd at least.
For details about/etc/hosts. deny, refer to the online help page of hosts_access. Read by tcpd at least.

Guide and login/logout

/Etc/issue &/etc/issue.net these files are read by mingetty (and similar programs) and used to access the slave terminal (issue) or via telnet session (issue.net) the connected user displays a "welcome" string. These include several lines of information that declares the Red Hat version number, name, and kernel ID. They are used by rc. local.
/Etc/redhat-release contains a line of information about the Red Hat version number and name. Used by rc. local.
/Etc/rc. d/rc is usually run at all running levels and transmitted as parameters. For example, to guide the machine in graph mode (X-Server), run the following command on the command line: init 5. Running level 5 indicates guiding the system in graphic mode.
/Etc/rc. d/rc. local is informal. It can be called from rc, rc. sysinit, or/etc/inittab.
/Etc/rc. d/rc. sysinit is usually the first script of all running levels.
/Etc/rc. d/rc/rcX. d scripts run from rc (X indicates any number between 1 and 5 ). These directories are specific "run-level" directories. When the system starts, it identifies the running level to be started, and then calls all the startup scripts in a specific directory of the running level. For example, the system usually displays the "enteringrun-level 3" message after the boot message, which means/etc/rc. all the initialization scripts in the d/rc3.d/directory will be called.

File system

The kernel provides an interface to display some of its data structures. these data structures may be useful for determining system parameters such as use interruptions, initialized devices, and memory statistics. This interface is provided as an independent but virtual file system, called/proc file system. Many system utilities use the values in the file system to display system statistics. For example, the/proc/modules file lists the modules currently loaded in the system. The lsmod command reads this information and displays it in a format that people can understand. The mtab file specified in the following table reads the/proc/mount file containing the currently installed file system in the same way.
/Etc/mtab will change with the change of the/proc/mount file. In other words, when the file system is installed and uninstalled, the changes will be immediately reflected in this file.
/Etc/fstab lists the file systems that can be installed on the computer. This is important because the computer will run the mount-a command during boot, which is responsible for installing each file system with the "1" mark in the penultimate column of fstab.
Configuration of all operations (Create directory, copy, format, and so on) on the/etc/mtools. conf DOS file system.

System Management

/Etc/group contains a valid group name and users in the specified group. A single user can execute multiple tasks in multiple groups. For example, if a "user" is a member of the "project1" project group and an administrator, the entry in the group file looks like this: user :*: group-id: project1
/Etc/nologin if a/etc/nologin file exists, login (1) will only allow access by the root user. It will display the content of this file to other users and refuse to log on to it.
For etc/passwd, see "man passwd ". It contains some user account information, including the password (if not encrypted by the shadow program ).
/Etc/rpmrc rpm command configuration. All rpm command line options can be set in this file, so that when any rpm command runs in this system, all options will apply globally.
/Etc/securetty contains the device name, which is composed of tty lines (each line has a name, excluding the previous/dev/). the root user is allowed to log on here.
/Etc/usertty
/Etc/shadow contains the encrypted user account password and password validity information. The following fields are included:
Login name
Encrypted password
Number of days from January 1, January 1, 1970 * to the last password change
Days before the password can be changed
Days before the password must be changed
Number of days the user is warned before the password expires
Number of days after password expiration when the account is disabled
Number of days from January 1, January 1, 1970 * to account disabled
/Etc/shells contains a list of possible "shells" available to the system.
/Etc/motd each message is used when the administrator wants to send a message to all users on the Linux server.

Networking

/Etc/gated. conf gated configuration. It can only be used by the gated daemon.
/Etc/gated. version contains the version number of the gated daemon.
/Etc/gateway is optional by the routed daemon.
/Etc/networks lists the network names and network addresses that can be accessed from the network connected by the machine. Use the routing command. The network name is allowed.
/Etc/protocols lists the currently available protocols. See The NAG (Network Administrator Guide, Network AdministratorsGuide) and online help page.
The C interface is getprotoent. It cannot be changed.
/Etc/resolv. conf tells the kernel which name server to query when the program requests to "parse" an IP address.
/Etc/rpc contains RPC commands/rules, which can be used in NFS calls or remote file system installation.
/Etc/exports File System (NFS) to be exported and its permissions.
/Etc/services converts the network service name to the port number/protocol. By inetd, telnet, TcpdumpAnd some other programs. There are some C access routines.
/Etc/inetd. conf inetd configuration file. See the inetd online help page. Contains entries for each network service. inetd must control the daemon or other services for these network services. Note that services will run, but are commented out in/etc/services, so that these services will become unavailable even when they are running. Format:
/Etc/ Sendmail. Cf email program SendmailConfiguration file. It is relatively obscure and hard to understand.
/Etc/sysconfig/network indicates NETWORKING = yes or no. Read by rc. sysinit at least.
/Etc/sysconfig/network-s cripts/if * Red Hat network configuration script.

System commands

System commands must control the system exclusively and make everything work normally. All programs such as login (completing the console user authentication phase) or bash (providing interaction between users and computers) are system commands. Therefore, files related to them are particularly important. This category contains the following files that interest users and administrators.
/Etc/lilo. conf contains the system's default pilot command line parameters, as well as different images used at startup. You can press the Tab key when prompted by LILO boot to see this list.
Maintain the * log file in the/etc/logrotate. conf/var/log directory.
/Etc/identd. conf identd is a server that implements the standard IDENT user identification protocol proposed by TCP/IP according to the method specified in RFC 1413. The operating principle of identd is to find a specific TCP/IP connection and return the user name of the process that owns the connection. It can also return other information, not the user name. See the identd online help page.
/Etc/ld. so. conf "Dynamic Link Program" (Dynamic Linker) configuration.
/Etc/inittab is the first configuration file in UNIX. The first program started after a UNIX machine is opened is init, which knows what to start. this is because of the existence of inittab. When the running level changes, init reads the inittab and controls the startup of the main process.
/Etc/termcap a database that contains all possible terminal types and the performance of these terminals.

Daemon
A Daemon is a program running in non-interactive mode. In general, Daemon tasks are related to the network areas: they wait for a connection to provide services through the connection. Linux can use many daemon processes from the Web server to the ftp server.
The configuration file of the/etc/syslogd. conf syslogd daemon. Syslogd is a daemon that records messages (written to a disk) sent from other programs to the system. This service is often used by some daemon. these daemon do not have other methods to send signals that may cause problems or send messages to users.
The configuration file of Apache on the/etc/httpd. conf Web server. This file is generally not in/etc. It may be in/usr/local/httpd/conf/or/etc/httpd/conf/, but to determine its location, you also need to check the specific Apache installation information.
/Etc/conf. modules or/etc/modules. conf kerneld configuration file. Interestingly, kerneld is not the "as a daemon" kernel. It is actually a daemon process responsible for loading additional kernel modules quickly as needed.

Change configuration file

When changing the configuration file, if the program is not controlled by the system administrator or the kernel, make sure that the program that uses the configuration is restarted. Normal users do not have the permission to start or stop System programs and/or daemon processes.

Kernel

Changing the configuration file in the kernel immediately affects the system. For example, changing the passwd file to add a user will immediately make the user available. In addition, the/proc/sys directory of any Linux system has some kernel adjustable parameters. Only super users can get write access to all these files; other users only have read-only access. The classification of files in this directory is the same as that of Linux kernel source code. Each file in this directory represents a kernel data structure that can be dynamically modified to change the system performance.

Note:
Before changing any file value, make sure that you fully understand the file to avoid irreparable damage to the system.
Files in the/proc/sys/kernel/Directory
File name
Description
Threads-max
The maximum number of tasks that the kernel can run.
Ctrl-alt-del
If the value is 1, pressing these keys will "completely" reboot the system.
Sysrq
If the value is 1, Alt-SysRq is activated.
Osrelease
Displays the release version number of the operating system.
Ostype
Displays the type of the operating system.
Hostname
The host name of the system.
Domainname
Network domain. The system is part of the network domain.
Modprobe
Specifies whether modprobe should automatically run at startup and load required modules.

Daemon and system programs
A Daemon is a program that always runs in the background. it silently executes its own tasks. Common daemon include in. ftpd (ftp server daemon), in. telnetd (telnet server daemon), and syslogd (system * log daemon ). Some daemon will closely monitor the configuration file during running and automatically reload it when the configuration file changes. However, most daemon do not automatically reload the configuration file. We need to "tell" in some way that these daemon configuration files have been changed and should be reloaded. You can use service commands to restart the service (on Red Hat Linux ).
   For exampleIf we change the network configuration, we need to issue the following:
Service network restart.
   Note:The most common services are scripts in the/etc/rc. d/init. d/* directory, which are started by init when the system is booted. Therefore, you can restart the service by performing the following operations:
/Etc/rc. d/init. d/start | stop | status
Start, stop, and status are input values accepted by these scripts for operations.

User program

The user or system program reads the configuration file every time it is started. Even so, remember that some system programs are different when the computer is turned on. Their behavior depends on what is read in the configuration file in/etc. Therefore, when your program starts for the first time, it reads the default configuration from the files in the/etc/directory. You can then customize the program by using the rc and. (dot) files, as shown in the following section.

   User configuration file:. (Point) file and rc file
We have seen how to easily configure the program. But what if some people do not like to configure the program in/etc? "Normal" users cannot simply enter/etc and change the configuration file. from the perspective of the file system, the configuration file owner is a root user! This is why most user programs define two configuration files: The first is at the "system" level, located at/etc/, and the other is "dedicated" for users ", it can be found in his or her main directory.

   For example, I installed a very useful wget utility in my system. /Etc/has a/etc/wgetrc file. In my main directory, there is a directory named. wgetrc file, which describes the custom configuration (this configuration file is loaded only when I, that is, the user runs the wget command ). Other users can also have the. wgetrc file in their home directory (/home/other). of course, only these users can read the file when running the wget command. In other words, the/etc/wgetrc file provides the "default" value for wget, while the/home/xxx/. wgetrc file lists the "custom items" of a user ". The important thing is that this is only a "general rule", not all cases. For example, a program like pine does not have any files in/etc/. it only has a custom configuration file named. pinerc in the user's home directory. Other programs may only have default configuration files in/etc/, and users may not be allowed to "customize" these configuration files (this is the case where only a few config. files are in the/etc directory ).

   Normally used rc and. (point) files
File name
Description
~ /. Bash_login
See "man bash ". If ~ /. Bash_profile does not exist, bash will ~ /. Bash_login ~ /. Bash_profile processing.
~ /. Bash_logout
See "man bash ". It is referenced by the bash logon shell when exiting.
~ /. Bash_profile
Use bash to log on to shell and reference/etc/profile.
~ /. Bash_history
List of previously executed commands.
~ /. Bashrc
See "man bash ". Referenced by bash non-logon interactive shell (no other files ). Unless BASH_ENV or ENV is set, non-interactive shell does not reference any files.
~ /. Emacs
It is read by emac at startup.
~ /. Forward
If an email address is included, all emails sent ~ The owner's email will be forwarded to this email address.
~ /. Fvwmrc ~ /. Fvwm2rc
Configuration files of fvwm and fvwm2 (basic X Window manager.
~ /. Hushlogin
See "man login ". Cause "no prompt" login (no email notification, last login information, or MOD information ).
~ /. Mail. rc
The user initialization file of the email program.
~ /. Ncftp/ncftp
Directory of the program. it contains bookmarks, * logs, macros, preferences, and tracking information. See man ncftp. Ncftp aims to provide a powerful and flexible interface for the Internet standard File TransferProtocol. It is designed to replace the standard ftp program used by the system.
~ /. Profile
See "man bash ". If ~ /. Bash_profile and ~ /. Bash_login file does not exist, bash will ~ /. Profile ~ /. Bash_profile is processed and used by other shell that inherit the Bourn.
~ /. Pinerc
Pine configuration
~ /. Muttrc
Mutt configuration
~ /. Exrc
This file can control the vi configuration.
Example:
Set ai sm ruler
Writing the above line in this file will enable vi to set automatic indent, matching brackets, displaying row numbers and row-column options.
~ /. Vimrc
The default "Vim" configuration file. Same as. exrc.
~ /. Gtkrc
GNOME Toolkit ).
~ /. Kderc
KDE configuration.
~ /. Netrc
Default ftp login name and password.
~ /. Rhosts
Used by r-tools (such as rsh and rlogin. Because it is easy to impersonate a host, the security is very low.
Required by the user (~ /Owner) or a Super User.
Lists hosts from which users can access this account.
If it is a symbolic link, it is ignored.
~ /. Rpmrc
See "man rpm ". If/etc/rpmrc does not exist, it is read by rpm.
~ /. Signature
The message text is automatically appended to the end of the email sent from this account.
~ /. Twmrc
The configuration file of twm (The Window Manager.
~ /. Xinitrc

It is read by X at startup (instead of by xinit script ). Generally, some programs are started.
Example:Exec/usr/sbin/startkde
If this line of content exists in the file, KDE WindowManager is started when the startx command is issued from this account ).
~ /. Xmodmaprc
This file is transferred to the xmodmap program and can be named as any file (for example ~ /. Xmodmap and ~ /. Keymap. km ).
~ /. Xserverrc
If xinit can find the X to be executed, xinit runs the file as the X server.
~ /News/Sent-Message-IDs
The default email history file of gnus.
~ /. Xauthority
Read and write by the xdm program to process permissions. See the X, xdm, and xauth online help pages.
~ /. Xdefaults,
~ /. Xdefaults-hostname is read by X application during host hostname startup. If the-hostname file cannot be found, find the. Xdefaults file.
~ /. Xmodmap
Point to. xmodmaprc; Red Hat has the. xinitrc file with this name.
~ /. Xresources
It is usually the name of the file that is transferred to xrdb to load X resource database. it is designed to prevent applications from reading a very long. Xdefaults file. (I used it in some cases ~ /. Xres.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.