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:
- Neil Matthew and Richard Stones, Beginning Linux Programming, 4/e, Wiley Publishing, Inc, 2007, page 191.
- /etc/shadow檔案結構. [Online]. Available: http://linux.vbird.org/linux_basic/0410accountmanager.php#shadow_file
No comments:
Post a Comment