etc_passwd
Table of Contents
/etc/passwd
- Definition: The /etc/passwd file is a system file on Unix-like operating systems that contains essential information about user accounts.
- Function: Stores user account information necessary for user login and system processes, but not passwords.
- Components: Each line in the /etc/passwd file represents a user account and consists of several fields separated by colons:
1. **Username**: The user’s login name. 2. **Password Placeholder**: An 'x' indicating that the password is stored in the /etc/shadow file. 3. **User ID (UID)**: A unique identifier for the user. 4. **Group ID (GID)**: A unique identifier for the user’s primary group. 5. **GECOS**: A field that typically contains the user's full name and other information. 6. **Home Directory**: The absolute path to the user’s home directory. 7. **Shell**: The command interpreter or shell assigned to the user.
- Features:
* Provides necessary information for user authentication and login. * Used by various system processes to retrieve user-related information. * Contains publicly readable information, but passwords are stored in /etc/shadow for security.
- Usage: Essential for system administration, used to manage and retrieve user account information.
Examples
- Sample entry in /etc/passwd:
```plaintext john:x:1001:1001:John Doe,,,:/home/john:/bin/bash ```
* **john**: Username * **x**: Password placeholder (indicates the actual password is in /etc/shadow) * **1001**: User ID (UID) * **1001**: Group ID (GID) * **John Doe,,,:**: GECOS field * **/home/john**: Home directory * **/bin/bash**: Shell
- Viewing the /etc/passwd file:
```bash cat /etc/passwd ```
- Adding a new user (modifies /etc/passwd):
```bash sudo useradd newuser ```
Summary
- /etc/passwd: A critical system file on Unix-like operating systems that contains user account information, necessary for user login and system processes, with passwords securely stored in the /etc/shadow file.
etc_passwd.txt · Last modified: 2024/08/07 04:34 by 127.0.0.1