Created scripts to get created users

main
Anthony 2023-11-02 01:33:56 +08:00
parent 173a3f3d72
commit 7f3baa84fd
1 changed files with 7 additions and 0 deletions

View File

@ -0,0 +1,7 @@
#!/bin/bash
getent passwd | awk -F: '/^user/ {print $1}' | while read -r user; do
# Attempt to get the user's creation date from the shadow file
creation_date=$(sudo chage -l "$user" | grep 'Last password change' | cut -d: -f2)
echo "$user was created on $creation_date"
done