博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
linux中的/etc/shadow文件简介
阅读量:4186 次
发布时间:2019-05-26

本文共 1167 字,大约阅读时间需要 3 分钟。

1、简介

     shadow文件存放用户密码文件,一般存放在/etc目录下。

2、详解

/* Structure of the password file.  */

struct spwd
  {
    char *sp_namp;              /* Login name.  */
    char *sp_pwdp;              /* Encrypted password.  */
    long int sp_lstchg;         /* Date of last change.  */
    long int sp_min;            /* Minimum number of days between changes.  */
    long int sp_max;            /* Maximum number of days between changes.  */
    long int sp_warn;           /* Number of days to warn user to change
                                   the password.  */
    long int sp_inact;          /* Number of days the account may be
                                   inactive.  */
    long int sp_expire;         /* Number of days since 1970-01-01 until
                                   account expires.  */
    unsigned long int sp_flag;  /* Reserved.  */
  };

     sp_namp表示账号名称

     sp_pwdp表示密码,这个密文字符串格式为:$id$salt$encrypted,通过$来分割
          $id用来指定使用的算法,
              ID  | Method
              ───────────────────────────────────────
              1   | MD5
              2a  | Blowfish (not in mainline glibc; added in some Linux distributions)
              5   | SHA-256 (since glibc 2.7)
              6   | SHA-512 (since glibc 2.7)
        例如:$1就是使用了MD5的算法
                  $salt 是一个最多16个字符的随机生成的字符串,增加破解难度
                  $encrypted 就是通过MD5和盐算出来的密文了
     sp_lstchg表示最近更改密码的日期(from 1974-1-1)
     sp_min表示密码不可更改的天数
     sp_max表示密码需要重新更改的天数
     sp_warn表示密码更改期限前的警告日期
     sp_inact表示密码过期的宽限时间
     sp_expire表示账号失效时间
     sp_flag表示保留

参考文献:http://blog.csdn.net/ouyang_peng/article/details/8732644

你可能感兴趣的文章
Python实现单向链表
查看>>
整数反转(Python,LeetCode)
查看>>
整数反转(Go,LeetCode)
查看>>
求最小公倍数(华为机试,Python)
查看>>
求最小公倍数(华为机试,Go)
查看>>
无重复字符的最长子串(Python,LeetCode)
查看>>
无重复字符的最长子串(Go,LeetCode)
查看>>
两数之和(Python,LeetCode)
查看>>
Python实现LRU缓存
查看>>
两数之和(Go,LeetCode)
查看>>
回文数(Go,LeetCode)
查看>>
Go获取操作系统位数
查看>>
Python 特殊方法__new__()
查看>>
Go实现单例模式
查看>>
Python实现单例模式
查看>>
寻找两个正序数组的中位数(Python,LeetCode)
查看>>
两数相加(Python,LeetCode)
查看>>
两数相加(Go,LeetCode)
查看>>
Go int类型的最大值和最小值
查看>>
最长回文子串(Python,LeetCode)
查看>>