Unix System data files

Source: Internet
Author: User

The normal operation of UNIX system requires the use of a large number of system-related data files, such as password file /etc/passwd, group file /etc/group, Network service /etc/services, protocol information /etc/protocols, network information /etc/networks, host data /etc/hosts and so on. The following is the main description of the password file.

Password file--

The UNIX system's password file may have the following line on Linux:

root:x:0:0:root:/root:/bin/bash

The above fields are separated by colons and correspond to the passwd structure defined in "Pwd.h":

/* the passwd structure.                */ struct  passwd{char  *pw_name;  /* Username.              */ char  *pw_passwd;  /* Password.               */ __uid_t pw_uid;  /* User ID.               */ __gid_t pw_gid;  /* Group ID.               */ char  *pw_gecos;  /* Real name.                 */ char  *pw_dir;  /* Home directory.               */ char  *pw_shell;  /* Shell program. */};

The encrypted password field contains a placeholder x, which, in earlier versions of UNIX systems, holds an encrypted password, storing the encrypted password in a human-readable file poses a security vulnerability, so now the encrypted password is stored in another location, the shadow password mentioned below.
On some systems, you can use the finger command to view the password file, and you can use the vipw command to edit the password file.

Shadow password--

The encrypted password is a copy of the user's password processed by the one-way encryption algorithm, on some systems, the encrypted password is stored in another file /etc/shadow , commonly called the shadow password, and the corresponding SPWD structure is defined in "Shadow.h":

/ * Structure of the password file. */structspwd {Char*sp_namp;/ * Login name. */    Char*SP_PWDP;/ * Encrypted password. */    Long intSp_lstchg;/ * Date change. */    Long intSp_min;/* Minimum number of days between changes. */    Long intSp_max;/* Maximum number of days between changes. */    Long intSp_warn;/* Number of days to warn user to change the password. */    Long intSp_inact;/* Number of days the account is inactive. */    Long intSp_expire;/* Number of days since 1970-01-01 until account expires. */    unsigned Long intSp_flag;/ * Reserved. */};

Different Unix-like systems may have different ways of storing encrypted passwords.
In addition to the data files mentioned above, most UNIX systems provide utmp and wtmp two data files that record the individual users who are currently logged in to the system, which tracks individual logon and logoff events. In addition, system identification information, time and date data are also essential.

Unix System data files

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.