is there any possibility to force users of one group to change password every few months?

I am using RedHat linux, and I am curious if there is any possibility to solve it with group and not for every single user?


There is no utility that does that automatically for you. You could however use similar code like this to achieve your goal.

gm=$(groupmems -g GroupName -l); declare -a members="($gm)"; for user in "${members[@]}"; do chage -d 0 "$user"; done

This command sets the value for the date the password was last changed to the epoch (January 1, 1970). This value forces immediate password expiration no matter what password aging policy, if any, is in place.

After you've tested the code, put it in a file, make it executable and let it run by cron job accordingly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.