Using Command "Chage" for Everyone in the Group Group
How Can I Use "Chage" Command to Change, for Example, Minimum Number of Days Before Password Change for Every User in the Group? 1 Answer I Don't Think There's...
How can i use "chage" command to change, for example, minimum number of days before password change for every user in the group?
1 Answer
I don't think there's a one-shot command to do this, so you would need to extract the list of members from the groups database and loop over it - exactly how you choose to do that is up to you but for example
#!/bin/bash
group='group'
mindays=28
IFS=, read -a members < <(getent group "$group" | cut -d: -f4)
for logname in "${members[@]}"; do
echo chage -m "$mindays" "$logname"
done
(remove the echo once you are satisfied that it will do the right thing).