目录
1. 密码存储位置
/etc/shadow 普通用户没有读权限--》sudo
2. 解析密码
#include <shadow.h>
struct spwd *getspnam(const char *name);
struct spwd {
char *sp_namp; /* Login name 用户登录名 */
char *sp_pwdp; /* Encrypted password 加密的密码 */
long sp_lstchg; /* Date of last change
(measured in days since
1970-01-01 00:00:00 +0000 (UTC)) 密码最后一次修改的时间 */
long sp_min; /* Min # of days between changes 修改密码的最小的时间间隔*/
long sp_max; /* Max # of days between changes */
long sp_warn; /* # of days before password expires
to warn user to change it 在密码到期前几天警告用户更改密码*/
long sp_inact; /* # of days after password expires
un