Sobre el archivo /etc/passwd

In the next commodity we are going to take a quick expect at / Etc / passwd. This file will shop essential information that is required during login on Gnu/Linux systems.. In other words, information related to user accounts will exist stored there. The file saves plain text, which will provide useful information for each user business relationship.

The file / Etc / passwd you must have general read permission, as many utilities use it to assign an ID to usernames. Write access to this file is limited to the superuser/root account.. The file is owned by root and has 644 permissions. Which ways that it tin can just be modified by root or users with sudo privileges.

Table of Contents

  • 1 A quick look at the /etc/passwd file
  • 2 What is the /etc/passwd file?
  • iii What is the use of this file?
  • 4 Format of the /etc /passwd file
    • four.1 /etc/passwd file values

A quick look at the /etc/passwd file

The name of the file originates from one of its initial functions. This contained the information used to verify the passwords of user accounts. Even so, on modern Unix systems, password information is usually stored in a dissimilar file, using shadow passwords or other database implementations.

It tin can be said that the file / Etc / passwd Information technology is a manifestly text based database, which contains information near all user accounts establish in the system.. As nosotros said, it is owned by root, and even though it can only be modified by root or users with sudo privileges, it is also readable by other users on the system.

What is the /etc/passwd file?

1 characteristic to highlight is that it is a unproblematic file of ascii text. This is a configuration file containing details regarding user accounts. Uniquely identifying users is essential and necessary at login time, and that is exactly where Gnu/Linux systems utilize / Etc / passwd.

cuenta de un usuario

In this plainly text file we volition find a list of the system accounts, saving from each account useful data such as user ID, group ID, home directory, shell and more than. Likewise, this must have general read permission, as many control utilities employ information technology to assign a user ID to usernames.

Although it is possible to add and manage users directly in this file, it is non recommended to practice and then, since this action can add errors, which would be a problem. Instead of doing it like this, your affair is to use the commands available for user administration.

What is the utilise of this file?

There are several dissimilar authentication schemes that can be used on Gnu/Linux systems. The most widely used standard scheme is to perform authentication on files / Etc / passwd y / Etc / shadow . In the File / Etc / passwd the list of organization users is stored along with important data about them. Thank you to this file, the organisation tin uniquely identify users, every bit this is essential and necessary when starting the respective session correctly.

The content of the file / Etc / passwd determines who can legitimately access the organisation and what they tin can do once within. This is why this file can perhaps exist considered the first line of defence force for the system to prevent unwanted access. For this reason, information technology is important to keep information technology bug and glitch free.

Format of the /etc /passwd file

In the content of this file, we volition find the username, the real name, the identification information and the basic information of the business relationship of each user. Equally we said, this is a text file with one entry per line, and each of these lines represents a user account.

For, view your content, users can utilise a text editor or a command like the post-obit:

Vista del contenido de /etc/passwd

cat /etc/passwd

Each line of the file / Etc / passwd will contain seven fields separated by dots (:). Typically, the first line describes the root user, followed by the organization and normal user accounts. New entries are added at the finish.

/etc/passwd file values

Adjacent nosotros are going to see what each of the values ​​that nosotros are going to find in each of the lines of the file means / Etc / passwd:

Valores del archivo /etc/passwd

  1. Username→ E sdue east used when the user logs in. It must be betwixt 1 and 32 characters long.
  2. Countersign→ The grapheme ten will point that the encrypted password is stored in the file / Etc / shadow.
  3. User ID (UID)→ Each user is assigned a user ID (UID) unique in the organization. UID 0 is reserved for root and UIDs i-99 are reserved for other predefined accounts. The organization will reserve other UIDs from 100 to 999 for authoritative and system accounts/groups.
  4. group ID (GID)→ This is the ID of the main group to which the user belongs (stored in the /etc/grouping file).
  5. User information (GECKOS)→ Here we will find the comment field. In this information technology is possible to add additional information about the users, such as the total proper name, the phone number, etc.
  6. Habitation directory→ Here we volition find the accented path to the user'southward "habitation" directory. If this directory does non exist, the user directory becomes /.
  7. Shell→ This is the absolute path of the shell (/ bin / bash). Although it might not be a shell every bit such. If the trounce is set to / sbin / nologin and the user tries to log in to the Gnu/Linux system directly, the crush / sbin / nologin will close the connection.

Equally we have said lines above, except for the password, with any text editor like «vim» or «gedit» and «root» privileges nosotros can change the behavior and configuration of all users stored in «/etc/passwd». Although it is as well necessary to insist that modifying this file should non be done except in an exceptional example (and knowing what is done), because if something is corrupted or deleted in an oversight, we can find ourselves facing a catastrophe, because in this file is the basic root of all the permissions that nosotros utilize and will utilize in the system