我一直在浏览笔记本电脑上的一些操作系统文件(F17),在读取/ etc / passwd文件时,我注意到每行都有相同的语法,用于不同的对象/命令,看起来像这样:
[key1]:x:[number]:[number]:[key2]:[directory]:[filepath]
这是完整的文件: (不了解操作系统,此文件中单个给定行的每个元素用于什么目的?)
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
gopher:x:13:30:gopher:/var/gopher:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
usbmuxd:x:113:113:usbmuxd user:/:/sbin/nologin
avahi-autoipd:x:170:170:Avahi IPv4LL Stack:/var/lib/avahi-autoipd:/sbin/nologin
smolt:x:999:998:Smolt:/usr/share/smolt:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
abrt:x:173:173::/etc/abrt:/sbin/nologin
avahi:x:70:70:Avahi mDNS/DNS-SD Stack:/var/run/avahi-daemon:/sbin/nologin
rtkit:x:172:172:RealtimeKit:/proc:/sbin/nologin
openvpn:x:998:996:OpenVPN:/etc/openvpn:/sbin/nologin
saslauth:x:997:995:"Saslauthd user":/run/saslauthd:/sbin/nologin
colord:x:996:994:User for colord:/var/lib/colord:/sbin/nologin
nm-openconnect:x:995:993:NetworkManager user for OpenConnect:/:/sbin/nologin
mailnull:x:47:47::/var/spool/mqueue:/sbin/nologin
smmsp:x:51:51::/var/spool/mqueue:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
chrony:x:994:992::/var/lib/chrony:/sbin/nologin
tcpdump:x:72:72::/:/sbin/nologin
pulse:x:993:991:PulseAudio System Daemon:/var/run/pulse:/sbin/nologin
gdm:x:42:42::/var/lib/gdm:/sbin/nologin
kendal:x:1000:1000:Kendal Harland:/home/kendal:/bin/bash
tss:x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin
jetty:x:110:110::/usr/share/jetty:/sbin/nologin
答案 0 :(得分:1)
真的,请检查man 5 passwd
,但基本上这是存储在那里的信息。
username:passwd:UID:GID:realname:homedir:shell
username - what username to login with
passwd - x indicates that /etc/shadow is used
UID - User ID
GID - Group ID
realname - Real name of user
homedir - Home directory i.e. /home/username
shell - what login shell the user uses