Thursday, April 17, 2014

Important information for Linux

The system file /etc/passwd contains a database dealing with user accounts. It consists of lines, one per user, that contain the username, encrypted password, user identifier (UID), group identifier (GID), full name, home directory, and default shell. Here’s an example line:

neil:zBqxfqedfpk:500:100:Neil Matthew:/home/neil:/bin/bash

If you write a program that determines the UID of the user who started it, you could extend it to look in the password file to find out the user’s login name and full name. We don’t recommend this because modern UNIX-like systems have moved away from using simple password files to improve system security. Many systems, including Linux, have the option to use shadow password files that don’t contain any useful encrypted password information at all (this is often held in /etc/shadow, a file that ordinary users cannot read).

Additionally, I also suggest that reader can refer to [2] to comprehend the details of shadow file.

Reference:

  1. Neil Matthew and Richard Stones, Beginning Linux Programming, 4/e, Wiley Publishing, Inc, 2007, page 191.
  2. /etc/shadow檔案結構. [Online]. Available: http://linux.vbird.org/linux_basic/0410accountmanager.php#shadow_file

No comments:

Post a Comment