Format of the /etc/passwd file
A non-shadowed /etc/passwd file has the following format:
Where:username:passwd:UID:GID:full_name:directory:shell
usernameThe user (login) name
passwdThe encoded password
UIDNumerical user ID
GIDNumerical default group ID
full_nameThe user's full name - Actually this field is called the GECOS (General Electric Comprehensive Operating System) field and can store information other than just the full name. The Shadow commands and manual pages refer to this field as the comment field.
directoryUser's home directory (Full pathname)
shellUser's login shell (Full Pathname)
Whereusername:Npge08pfz4wuk:503:100:Full Name:/home/username:/bin/sh
Np is the salt and ge08pfz4wuk is the encoded password. The encoded salt/password could just as easily have been kbeMVnZM0oL7I and the two are exactly the same password. There are 4096 possible encodings for the same password. (The example password in this case is 'password', a really bad password). Once the shadow suite is installed, the /etc/passwd file would instead contain:
Theusername:x:503:100:Full Name:/home/username:/bin/sh
x in the second field in this case is now just a place holder. The format of the /etc/passwd file really didn't change, it just no longer contains the encoded password. This means that any program that reads the /etc/passwd file but does not actually need to verify passwords will still operate correctly. The passwords are now relocated to the shadow file (usually /etc/shadow file).
Format of the shadow file
The /etc/shadow file contains the following information:
Where:username:passwd:last:may:must:warn:expire:disable:reserved
usernameThe User Name
passwdThe Encoded password
lastDays since Jan 1, 1970 that password was last changed
mayDays before password may be changed
mustDays after which password must be changed
warnDays before password is to expire that user is warned
expireDays after password expires that account is disabled
disableDays since Jan 1, 1970 that account is disabled
reservedA reserved field
username:Npge08pfz4wuk:9479:0:10000::::
No comments:
Post a Comment