what is difference between /etc/shadow and /etc/passwd

passwd is the file where the user information (like username, user ID, group ID, location of home directory, login shell, …) is stored when a new user is created.

shadow is the file where important information (like an encrypted form of the password of a user, the day the password expires, whether or not the passwd has to be changed, the minimum and maximum time between password changes, …) is stored when a new user is created.

  • In the line:
    • root:my_password:0:0:root:/root:/bin/bash
  • The field match:
    • login:pwd:iduser:idgroup:homedirectory:shell
  • /etc/passwd is readable by everyone but the passwords are stored in /etc/shadow, are only readable only under root account. They are encoded with MD5 for better security.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s