[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