Created a UID>=1000 report
This commit is contained in:
parent
683f5de32c
commit
d211e95db4
14
user-report/report.sh
Executable file
14
user-report/report.sh
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Returns a list of all users on the system with UID >= 1000 and their home directory and shell
|
||||||
|
# Sorted lexicographically by uid
|
||||||
|
# Uses getent passwd so as to include remote users (e.g. LDAP) in the list
|
||||||
|
|
||||||
|
# getent passwd returns a list of all users on the system, local and remote
|
||||||
|
# it may return duplicates, since a user might be listed identically in multiple nsswitch databases (e.g. files and systemd)
|
||||||
|
for uid in $(getent passwd | cut -d: -f3 | sort | uniq); do
|
||||||
|
if [ $uid -ge 1000 ]; then
|
||||||
|
# Use AWK to parse the output of the passwd entry
|
||||||
|
getent passwd $uid | awk -F: '{print "User: " $1 ", UID: " $3 ", Home: " $6 ", Shell: " $7}'
|
||||||
|
fi
|
||||||
|
done
|
||||||
Loading…
x
Reference in New Issue
Block a user