[root@hf-01 ~]# ls /etc/passwd /etc/passwd [root@hf-01 ~]# head -n3 /etc/passwd root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin [root@hf-01 ~]#
由用户占一行,并让:分割为7缎。 root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin 用户名:x表示密码:uid:gid:注释信息:家目录:用户shell
[root@hf-01 ~]# ls /etc/shadow /etc/shadow [root@hf-01 ~]# head -n3 /etc/shadow root:$6$sCk3CX.t$wsJ6nme.nhntEimBALd/TJtn6cGcrgUiac9czVPM1W54e2ED6HGtT2LOaWpK62VbbkcW6fBAq6Kaupj/tEld30:17419:0:99999:7::: bin:*:16231:0:99999:7::: daemon:*:16231:0:99999:7::: [root@hf-01 ~]#
由于仅仅给root用户设置了密码,因此在这里只有root有密码,这是加密的密码,不能去编译。 由一个明文得到加密的密码,不能从加密的密码得到一个明文密码。
[root@hf-01 ~]# passwd hanfeng 更改用户 hanfeng 的密码 。 新的 密码: 无效的密码: 密码少于 8 个字符 从新输入新的 密码: passwd:全部的身份验证令牌已经成功更新。 [root@hf-01 ~]# head -n1 /etc/shadow; tail -n2 /etc/shadow root:$6$sCk3CX.t$wsJ6nme.nhntEimBALd/TJtn6cGcrgUiac9czVPM1W54e2ED6HGtT2LOaWpK62VbbkcW6fBAq6Kaupj/tEld30:17419:0:99999:7::: hanfeng:$6$jV74kWmS$GPP5amnrGjHQuAxqAAxyKHmLp6lOXd64pWl1YxVu5VfJSSJPFk4DvLhWhYM1.BfmXA32leqCMLcJYPeCmdBK/.:17469:0:99999:7::: user1:!!:17465:0:99999:7::: [root@hf-01 ~]#
只要了解大概字段的含义便可,在工做中使用不多shell