summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2019-09-29 20:27:46 -0600
committermo khan <mo.khan@gmail.com>2019-09-29 20:27:46 -0600
commitacadf7749ae6469f9d0fb946b4cb5cc5dcf17940 (patch)
treeaddca9075704dc77d370581b6136a68686f8c2b8
parenta4809f8c5ca83960bb946012a74d1b0c6f65eb70 (diff)
Find entries with id 0
-rw-r--r--README.md7
-rwxr-xr-xbin/uid-zero3
2 files changed, 10 insertions, 0 deletions
diff --git a/README.md b/README.md
index d8d1710..13c1fe5 100644
--- a/README.md
+++ b/README.md
@@ -1127,6 +1127,13 @@ Rootly Powers and Processes
1. Write a shell script to help monitor the health of your /etc/passwd file.
a. Find entries that have UID 0.
+
+ ```bash
+ #!/bin/sh
+
+ cat /etc/passwd | grep -P '^\w+:[x]:\d+:0.*$'
+ ```
+
b. Find entries that have that have no password (needs /etc/shadow).
c. Find any sets of entries that have duplicate UIDs.
d. Find entries that have duplicate login names.
diff --git a/bin/uid-zero b/bin/uid-zero
new file mode 100755
index 0000000..129d587
--- /dev/null
+++ b/bin/uid-zero
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+cat /etc/passwd | grep -P '^\w+:[x]:\d+:0.*$'