User and Password Policy

Hi linux expert,

i would like to create a script for listing all user with there password policy. It should be in the following format:

Last password change : Sep 19, 2011
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7

followed by all other users.

i can use chage to get list above detail for each user, but i have to do it one by one.

this there way where i can generate a list for all user/password policy.

thank
yann

#!/bin/sh

ALL_USERS=$( getent passwd | cut -f1 -d':' )
for user in $ALL_USERS; do
  echo $user
  chage -l $user
  sleep 1
done
1 Like