Let’s take a look at the general contents of the etc directory
Contains many files. Many network configuration files are also in / etc
/etc/rc or/etc/rc.d or/etc/rc*.d
Start, or change the scripts or scripts directory running at runtime
User database, in which domain gives user name, real name, home directory, encrypted password and other information of user
Floppy disk parameter table. Describes different floppy disk formats. Set with setfdprm
Mount – a command (in / etc / RC or equivalent boot file) automatically lists the file system of mount at startup. Under Linux, it also includes the information of the swap area enabled with swap on – A
Similar to / etc / passwd, but not users, but groups
Init configuration file
The output message of Getty before the login prompt. It usually includes a short description or welcome message of the system. The content is determined by the system administrator
File configuration file. Contains descriptions of different file formats. File guesses the file type based on it
Message of the day is automatically output after successful login. The content is determined by the system administrator. It is often used to announce information, such as the warning of planned shutdown time
List of currently installed file systems. Initialized by scripts and automatically updated by Mount command. Used when a list of currently installed file systems is needed, such as DF command
Shadow password file on the system with Shadow Password software installed. The shadow password file moves the encrypted password in / etc / passwd file to / etc / shadow, which is only readable to root. This makes it more difficult to decipher the password
The configuration file for the login command
Similar to / etc / termcap, but for printers. Syntax is different
/etc/profile , /etc/csh.login ,/etc/csh.cshrc
This allows the system administrator to set up a global default environment for all users
Confirm the security terminal, that is, which terminal allows root to log in. Generally, only the virtual console is listed, so it is impossible (at least very difficult) to break into the system through modem or network and get super user privileges
List the trusted shell. Chsh command allows the user to change the login shell within the scope specified in this file. Ftpd, the service process that provides a machine FTP service, checks whether the user’s shell is listed in the / etc / shells file. If not, the user will not be allowed to log in
Terminal performance database. Explain what “escape sequence” is used to control different terminals. When writing a program, it does not directly output escape sequence (so it can only work on a specific brand of terminals), but finds the correct sequence of the work to be done from / etc / termcap. In this way, most programs can run on most terminals
In this part, we mainly introduce a user configuration file in the / etc directory, / etc / passwd.
/In etc / passwd, one line of records corresponds to one user, and each line of records is separated into seven fields by a colon (the format and specific meaning are as follows:
User name: Password: user ID: group ID: annotative Description: Home Directory: login shell
1) “User name” is a string representing the user account. It is usually no more than 8 characters long and consists of uppercase and lowercase letters and / or numbers (Linux systems are generally case sensitive). You cannot have a colon in the login because the colon is a separator here. For compatibility, it is best not to include a dot (.) in the login name, and not to start with a hyphen (-) and a plus sign (+).
2) “Password” in some systems, the encrypted user password is stored. Although this field only stores the encrypted string of user password, not plaintext, it is still a security risk because the / etc / passwd file is readable to all users. Therefore, now many linux systems (such as SVR4) use shadow technology to store the real encrypted user password in the / etc / shadow file, while only one special character, such as “X” or “*” is stored in the password field of the / etc / passwd file.
3) “User identification number” is an integer used by the system to identify users. In general, it corresponds to the user name one by one. If the user ID corresponding to several user names is the same, they will be regarded as the same user in the system, but they can have different passwords, different home directories and different login shells.
Generally, the value range of user identification number is 0-65535. 0 is the identification number of the super user root, 1-99 is reserved by the system as the management account, and the identification number of ordinary users starts from 100. In Linux, the limit is 500.
4) The group ID field records the user group to which the user belongs. It corresponds to a record in the / etc / group file.
5) The “annotative description” field records some personal information of the user, such as the user’s real name, telephone number, address, etc. this field has no practical use. In different Linux systems, the format of this field is not uniform. In many linux systems, this field stores an arbitrary piece of explanatory description text, which is used as the output of finger command.
6) “Home directory”, that is, the user’s starting working directory, is the directory where the user logs in to the system. In most systems, the home directory of each user is organized in the same specific directory, and the name of the user’s home directory is the login name of the user. Each user has read, write and execute (search) permissions on his / her home directory, while the access permissions of other users are set according to the specific situation.
7) After the user logs in, it starts a process, which is responsible for transferring the user’s operation to the kernel. This process is the command interpreter or a specific program that the user runs after logging in to the system, namely shell. Shell is the interface between user and Linux system. There are many kinds of shell in Linux, each of which has different characteristics. Commonly used are sh (Bourne shell), CSH (C shell), KSH (Korn shell), tcsh (tenex / tops-20 type C shell), bash (Bourne again shell), etc. System administrators can specify a shell for users according to system conditions and user habits. If shell is not specified, the system uses sh as the default login shell, that is, the value of this field is / bin / sh.
The user’s login shell can also be specified as a specific program (this program is not a command interpreter). Using this feature, we can limit the user to only run the specified application. After the application is finished, the user will exit the system automatically. Some Linux systems require that only those programs registered in the system can appear in this field.