04 5 Etc Passwd
04 5 Etc Passwd
Jan Schaumann
[email protected]
https://stevens.netmeister.org/631/
CS631 - Advanced Programming in the UNIX Environment
/etc/passwd
Called a user database by POSIX and usually found in /etc/passwd, the password file
contains the following fields:
2
Jan Schaumann 2020-09-23
CS631 - Advanced Programming in the UNIX Environment
/etc/passwd
root:*:0:0:Charlie &:/root:/bin/csh pw_name
toor:*:0:0:Bourne-again Superuser:/root:/rescue/sh pw_passwd
pw_uid
daemon:*:1:1:The devil himself:/:/sbin/nologin
pw_gid
operator:*:2:5:System &:/usr/guest/operator:/sbin/nologin
pw_gecos
bin:*:3:7:Binaries Commands and Source:/:/sbin/nologin
pw_dir
games:*:7:13:& pseudo-user:/usr/games:/sbin/nologin pw_shell
postfix:*:12:12:& pseudo-user:/var/spool/postfix:/sbin/nologin
named:*:14:14:& pseudo-user:/var/chroot/named:/sbin/nologin
ntpd:*:15:15:& pseudo-user:/var/chroot/ntpd:/sbin/nologin
sshd:*:16:16:& pseudo-user:/var/chroot/sshd:/sbin/nologin
uucp:*:66:1:UNIX-to-UNIX Copy:/nonexistent:/sbin/nologin
nobody:*:32767:39:Unprivileged user:/nonexistent:/sbin/nologin
jschauma:*:1000:100:Jan Schaumann,Lieb Building,555-1234,555-2233:/home/jschauma:/bin/sh
fred::1001:100:::/bin/sh
drwho:*:1003:100:The Doctor:/home/drwho:/bin/date
alice:*:1004:100::/home/alice:
alice:*:1002:100::/home/alice:/bin/ksh
3
Jan Schaumann 2020-09-23
CS631 - Advanced Programming in the UNIX Environment
/etc/passwd
root:*:0:0:Charlie &:/root:/bin/csh pw_name
toor:*:0:0:Bourne-again Superuser:/root:/rescue/sh pw_passwd
pw_uid
daemon:*:1:1:The devil himself:/:/sbin/nologin
pw_gid
operator:*:2:5:System &:/usr/guest/operator:/sbin/nologin
pw_gecos
bin:*:3:7:Binaries Commands and Source:/:/sbin/nologin
pw_dir
games:*:7:13:& pseudo-user:/usr/games:/sbin/nologin pw_shell
postfix:*:12:12:& pseudo-user:/var/spool/postfix:/sbin/nologin
named:*:14:14:& pseudo-user:/var/chroot/named:/sbin/nologin
ntpd:*:15:15:& pseudo-user:/var/chroot/ntpd:/sbin/nologin
sshd:*:16:16:& pseudo-user:/var/chroot/sshd:/sbin/nologin
uucp:*:66:1:UNIX-to-UNIX Copy:/nonexistent:/sbin/nologin
nobody:*:32767:39:Unprivileged user:/nonexistent:/sbin/nologin
jschauma:*:1000:100:Jan Schaumann,Lieb Building,555-1234,555-2233:/home/jschauma:/bin/sh
fred::1001:100:::/bin/sh
drwho:*:1003:100:The Doctor:/home/drwho:/bin/date
alice:*:1004:100::/home/alice:
alice:*:1002:100::/home/alice:/bin/ksh
4
Jan Schaumann 2020-09-23
CS631 - Advanced Programming in the UNIX Environment
System Databases
5
Jan Schaumann 2020-09-23
CS631 - Advanced Programming in the UNIX Environment
/etc/passwd
• Most fields in the password database may be empty:
• empty password field: anybody can log in (probably a mistake)
• empty home directory field: use / instead
• empty shell field: use /bin/sh instead
6
Jan Schaumann 2020-09-23