xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

Linux /etc/passwd and /etc/shadow All In One

Linux /etc/passwd and /etc/shadow All In One

/etc/passwd

Linux 用户管理
Linux 用户权限管理

/etc/shadow

eric@rpi4b:~ $ cat /etc/shadow
cat: /etc/shadow: 权限不够
eric@rpi4b:~ $ sudo cat /etc/shadow
root:*:19480:0:99999:7:::
daemon:*:19480:0:99999:7:::
bin:*:19480:0:99999:7:::
sys:*:19480:0:99999:7:::
sync:*:19480:0:99999:7:::
games:*:19480:0:99999:7:::
man:*:19480:0:99999:7:::
lp:*:19480:0:99999:7:::
mail:*:19480:0:99999:7:::
news:*:19480:0:99999:7:::
uucp:*:19480:0:99999:7:::
proxy:*:19480:0:99999:7:::
www-data:*:19480:0:99999:7:::
backup:*:19480:0:99999:7:::
list:*:19480:0:99999:7:::
irc:*:19480:0:99999:7:::
gnats:*:19480:0:99999:7:::
nobody:*:19480:0:99999:7:::
_apt:*:19480:0:99999:7:::
systemd-network:*:19480:0:99999:7:::
systemd-resolve:*:19480:0:99999:7:::
systemd-timesync:*:19480:0:99999:7:::
messagebus:*:19480:0:99999:7:::
_rpc:*:19480:0:99999:7:::
sshd:*:19480:0:99999:7:::
statd:*:19480:0:99999:7:::
avahi:*:19480:0:99999:7:::
dnsmasq:*:19480:0:99999:7:::
lightdm:*:19480:0:99999:7:::
rtkit:*:19480:0:99999:7:::
pulse:*:19480:0:99999:7:::
saned:*:19480:0:99999:7:::
colord:*:19480:0:99999:7:::
hplip:*:19480:0:99999:7:::
systemd-coredump:!*:19480::::::
eric:$5$oKqRAUFEF3m$e1JFWDLvBxYZiLkUs35Qb8dbwfTPkLwXNQOTMOeqN1:19480:0:99999:7:::
ftp:*:19517:0:99999:7:::

image

demos

2022年下半年信息安全工程师案例分析真题答案解析

https://www.cnitpm.com/pm1/130565.html

Raspberry Pi 4B

eric@rpi4b:~ $ cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
_apt:x:100:65534::/nonexistent:/usr/sbin/nologin
systemd-network:x:101:102:systemd Network Management,,,:/run/systemd:/usr/sbin/nologin
systemd-resolve:x:102:103:systemd Resolver,,,:/run/systemd:/usr/sbin/nologin
systemd-timesync:x:103:109:systemd Time Synchronization,,,:/run/systemd:/usr/sbin/nologin
messagebus:x:104:110::/nonexistent:/usr/sbin/nologin
_rpc:x:105:65534::/run/rpcbind:/usr/sbin/nologin
sshd:x:106:65534::/run/sshd:/usr/sbin/nologin
statd:x:107:65534::/var/lib/nfs:/usr/sbin/nologin
avahi:x:108:113:Avahi mDNS daemon,,,:/run/avahi-daemon:/usr/sbin/nologin
dnsmasq:x:109:65534:dnsmasq,,,:/var/lib/misc:/usr/sbin/nologin
lightdm:x:110:114:Light Display Manager:/var/lib/lightdm:/bin/false
rtkit:x:111:116:RealtimeKit,,,:/proc:/usr/sbin/nologin
pulse:x:112:119:PulseAudio daemon,,,:/run/pulse:/usr/sbin/nologin
saned:x:113:122::/var/lib/saned:/usr/sbin/nologin
colord:x:114:123:colord colour management daemon,,,:/var/lib/colord:/usr/sbin/nologin
hplip:x:115:7:HPLIP system user,,,:/run/hplip:/bin/false
systemd-coredump:x:996:996:systemd Core Dumper:/:/usr/sbin/nologin
eric:x:1000:1000:,,,:/home/eric:/bin/bash
ftp:x:116:124:ftp daemon,,,:/srv/ftp:/usr/sbin/nologin

(🐞 反爬虫测试!打击盗版⚠️)如果你看到这个信息, 说明这是一篇剽窃的文章,请访问 https://www.cnblogs.com/xgqfrms/ 查看原创文章!

passwd

$ man passwd

$ man passwd > ./man-docs/passwd.md
$ cat ./man-docs/passwd.md

shadow

$ man shadow

$ man shadow > ./man-docs/shadow.md
$ cat ./man-docs/shadow.md

SHADOW(5)                           文件格式和转化                          SHADOW(5)

名称
       shadow - 影子化了的密码文件

描述
       shadow is a file which contains the password information for the system's
       accounts and optional aging information.

       如果没有维护好密码安全,此文件绝对不能让普通用户可读。

       Each line of this file contains 9 fields, separated by colons (“:”), in the
       following order:

       登录名
           必须是有效的账户名,且已经存在于系统中。

       加密了的密码
           This field may be empty, in which case no passwords are required to
           authenticate as the specified login name. However, some applications which
           read the /etc/shadow file may decide not to permit any access at all if
           the password field is empty.

           A password field which starts with an exclamation mark means that the
           password is locked. The remaining characters on the line represent the
           password field before the password was locked.

           Refer to crypt(3) for details on how this string is interpreted.

           If the password field contains some string that is not a valid result of
           crypt(3), for instance ! or *, the user will not be able to use a unix
           password to log in (but the user may log in the system by other means).

       最后一次更改密码的日期
           最近一次更改密码的时间,表示从1970年1月1日开始的天数。

           The value 0 has a special meaning, which is that the user should change
           her password the next time she will log in the system.

           空字段表示密码年龄功能被禁用。

       密码的最小年龄
           最小密码年龄是指,用户一次更改密码之后,要等多长时间才再次被允许更改密码。

           空字段或 0 表示没有最小密码年龄。

       最大密码年龄
           最大密码年龄是指,这写天之后,用户必须更改密码。

           这写天之后,密码仍然可用。用户将会在下次登录的时候被要求更改密码。

           空字段表示没有最大密码年龄,没有密码警告时间段,没有密码禁用时间段(请看下
           边)。

           如果最大密码年龄小于最小密码年龄,用户将会不能更改密码。

       密码警告时间段
           密码过期之前,提前警告用户的的天数(请参考上边的密码的最大年龄)。

           空字段或者 0 表示没有密码警告期。

       密码禁用期
           密码过期(查看上边的密码最大年龄)后,仍然接受此密码的天数(在此期间,用户应
           该在下次登录时修改密码)。

           密码到期并且过了这个宽限期之后,使用用户的当前的密码将会不能登录。用户需要
           联系系统管理员。

           空字段表示没有强制密码过期。

       账户过期日期
           账户过期的日期,表示从1970年1月1日开始的天数。

           Note that an account expiration differs from a password expiration. In
           case of an account expiration, the user shall not be allowed to login. In
           case of a password expiration, the user is not allowed to login using her
           password.

           空字段表示账户永不过期。

           应该避免使用 0,因为它既能理解成永不过期也能理解成在1970年1月1日过期。

       保留字段
           此字段保留作将来使用。

文件
       /etc/passwd
           用户账户信息。

       /etc/shadow
           安全用户账户信息。

       /etc/shadow-
           /etc/shadow 的备份文件。

           注意,此文件由 shadow 工具集使用,而不是所有的用户和密码管理工具都会使用。

参见
       chage(1), login(1), passwd(1), passwd(5), pwck(8), pwconv(8), pwunconv(8),
       su(1), sulogin(8).

shadow-utils 4.8.1                    2020-02-07                            SHADOW(5)

refs

https://www.cnblogs.com/xgqfrms/p/17268158.html#5193867

https://www.cnblogs.com/xgqfrms/p/17320122.html

https://www.cnblogs.com/xgqfrms/p/17446689.html

https://linux.xgqfrms.xyz/linux_basic/0410accountmanager.htm



©xgqfrms 2012-2021

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2023-07-15 23:22  xgqfrms  阅读(19)  评论(2编辑  收藏  举报