Adjusting password policies
As was mentioned in Chapter 3, Basic Commands and Simple Shell Scripts, users are stored in the /etc/passwd
file while the encrypted passwords, or password hashes, are stored in the /etc/shadow
file.
Tip
A hashing algorithm is made so that it generates a precise string of characters, or a hash, from a provided piece of data (that is, a file or a word). It does it in a way so that it will always generate the same hash from the same original data, but the original data is almost impossible to recreate from the hash. That's why they are used to store passwords or verify the integrity of a downloaded file.
Let's take a look at one example by running grep
user as root
against /etc/shadow
:
user:$6$tOT/cvZ4PWRcl8XX$0v3.ADE/ibzlUGbDLer0ZYaMPNRJ5gK17LeKnoMfKK9 .nFz8grN3IafmHvoHPuh3XrU81nJu0.is5znztB64Y/:18650:0:99999:7:3:19113:
As with the password file, the data stored in /etc/shadow
has an entry per line and the fields are separated by...