In Linux system administration, user account management is a important aspect of maintaining system security and controlling access to resources. To effectively manage user accounts, there are three important files that play a significant role. These files are /etc/passwd, /etc/shadow, and /etc/group.
The /etc/passwd file is a plaintext file that contains essential information about each user account on the system. It stores details such as the username, user ID (UID), group ID (GID), home directory, and default shell. Each line in the file represents a separate user account, and the fields are separated by colons. For example, consider the following entry in the /etc/passwd file:
john:x:1001:1001:John Doe:/home/john:/bin/bash
In this example, "john" is the username, "x" represents the password field (which is now stored in /etc/shadow for security reasons), "1001" is the UID, "1001" is the GID, "/home/john" is the home directory, and "/bin/bash" is the default shell.
The /etc/shadow file, on the other hand, is a restricted file that contains encrypted password hashes for user accounts. It provides an extra layer of security by keeping the password information separate from the /etc/passwd file. The /etc/shadow file is readable only by the root user, ensuring that unauthorized users cannot access or tamper with the password hashes. Each line in the file corresponds to a user account and consists of multiple fields, separated by colons. For example:
john:$6$X3q2Xy2g$uXQk4L9Y8i4OuRqV7U6qT3zG2g6T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g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2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2T2g2
Other recent questions and answers regarding Basic Linux sysadmin tasks:
- How can the useradd command be used to create a new user account?
- What commands can be used to manage user accounts in Linux?
- What is the purpose of the `/etc/shadow` file?
- How are passwords stored and managed in Linux?
- How can you determine the ownership and permissions of objects in Linux?
- What is the purpose of groups in Linux access control?
- What are some tasks that can only be performed by the root user?
- How does the root user differ from regular users in terms of access control?
- What is access control in Linux and why is it important for system administration?
- How can you change the owner of a file or directory in Linux using the command line?
View more questions and answers in Basic Linux sysadmin tasks

