Debian Codegraph @

userlist.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 # userlist.sh
3
4 PASSWORD_FILE=/etc/passwdscip-shell filesystem . . `/etc/passwd`.
5 n=1 # User number
6
7 for name in $(awkscip-shell system . . awk. 'BEGIN{FS=":"}{print $1}' < "$PASSWORD_FILE" )
8 # Field separator = : ^^^^^^
9 # Print first field ^^^^^^^^
10 # Get input from password file /etc/passwd ^^^^^^^^^^^^^^^^^
11 do
12 echoscip-shell system . . echo. "USER #$n = $name"
13 let "n += 1"
14 done
15
16
17 # USER #1 = root
18 # USER #2 = bin
19 # USER #3 = daemon
20 # ...
21 # USER #33 = bozo
22
23 exit $?
24
25 # Discussion:
26 # ----------
27 # How is it that an ordinary user, or a script run by same,
28 #+ can read /etc/passwd? (Hint: Check the /etc/passwd file permissions.)
29 # Is this a security hole? Why or why not?