add-sftp-user/scripts/userlogs.sh

8 lines
289 B
Bash

#!/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