Understand Linux configuration files

Source: Internet
Author: User
Tags ftp login domain name server file transfer protocol

Introduction

Each LinuxProgramIt is an executable file that contains a list of operation codes. The CPU will execute these operation codes to complete specific operations. For example, the LS command is provided by the/bin/ls file. This file contains a list of machine commands, which must be used to display the list of files in the current directory on the screen. Almost every program's behavior can be customized by modifying its configuration file according to your preferences or needs.

Is there a standard configuration file format in Linux?
In a word, no. Users who are not familiar with Linux will be frustrated, because every configuration file looks like a new challenge. In Linux, Every programmer is free to choose his or her preferred configuration file format. You can select many formats, from the/etc/shells file (which contains a list of shells separated by a line break) to the complicated/etc/httpd. conf file of Apache.

What is a 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.
/Etc/hosts. Allow See the online help page of hosts_access. Read by tcpd at least.
/Etc/hosts. Deny See 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 display a "welcome" string to users connected to the terminal (Issue) or via the Telnet session (issue.net. 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 information about the Red Hat version and name. Used by RC. Local.
/Etc/rc. d/RC Generally run at all running levels, and the level is transmitted as a parameter. For example, to guide a machine in the graphic 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 Informal. It can be called from RC, RC. sysinit, or/etc/inittab.
/Etc/rc. d/rc. sysinit It is usually the first script of all running levels.
/Etc/rc. d/RC/rcX. d Scripts run from RC (XRepresents 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 "entering run-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 This will change as the/proc/mount file changes. In other words, when the file system is installed and uninstalled, the changes will be immediately reflected in this file.
/Etc/fstab List the file systems that can be installed on the computer. This is very important because the computer will run during bootMount-Command to install each file system with the "1" mark in the penultimate column of fstab.
/Etc/mtools. conf Configuration of all operations (create directory, copy, format, and so on) on the 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 "Project 1" project group and an administrator, the entries in the group file will look 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.
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 The device name is composed of tty lines (one name per line, excluding the previous/dev/). The root user is allowed to log on here.
/Etc/usertty 
/Etc/shadow
Password information of the encrypted user account, 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 List of possible "shells" available to the system.
/Etc/motd Daily message, which 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 It can be used by the routed daemon.
/Etc/networks Lists the network names and network addresses accessible from the network connected to the machine. Use the routing command. The network name is allowed.
/Etc/protocols List currently available protocols. See the nag (Network Administrator guide, network administrators Guide) and online help page. The C interface is getprotoent. It cannot be changed.
/Etc/resolv. conf When a program requests "Parsing" an IP address, it tells the kernel which name server should be queried.
/Etc/RPC Contains RPC commands/rules, which can be used in NFS calls or remote file system installation.
/Etc/exports The file system (NFS) to be exported and its permissions.
/Etc/services Convert the network service name to the port number/protocol. It is read by inetd, telnet, tcpdump, and 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: <SERVICE_NAME> <sock_type> <proto> <flags> <user> <server_path> <ARGs>
/Etc/sendmail. cf The configuration file of the mail program Sendmail. It is relatively obscure and hard to understand.
/Etc/sysconfig/Network Specify networking = yes or no. Read by RC. sysinit at least.
/Etc/sysconfig/network-scripts/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 Bootstrap command line parameters and different images used at startup. You can press the tab key when prompted by lilo boot to see this list.
/etc/logrotate. conf maintain the log files in the/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 Configuration of "Dynamic Link program" (dynamic linker.
/etc/inittab in terms of time, this 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 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.

 

/Etc/syslogd. conf The configuration file of the 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.
/Etc/httpd. conf The configuration file of Apache on the 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.

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 program directory; 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 transfer protocol. 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.
  1. Required by the user (~ /Owner) or a Super User.
  2. Lists hosts from which users can access this account.
  3. 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 TWM (THeWIndowMAnager) configuration file.
~ /. 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 this file, Kde window manager 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 X application reads the host hostname during startup. If the-hostname file cannot be found, find the. xdefaults file.
~ /. Xmodmap Point. XmodmaprcRed 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 .)
~ /Mbox The user's old email.

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.