Hi. I have a config file that is the output of the chage command formatted to my liking for python parsing. I would like to return the section name (in this case a username) if 'Account expires = never' and 'Password inactive = never'. Both must match to let me know that the account is still accessible. If only one parameter value of those is never, then it will mean the account is locked. I need to know if accounts are still open. I know there are other ways but I am specifically doing this in python.
Here is what the config file looks like:
[user1]
Last_password_c hange = password_must_b e_changed
Password_expire s = never
Password_inacti ve = never
Account_expires = never
Minimum_number_ of_days_between _password_chang e = 7
Maximum_number_ of_days_between _password_chang e = 90
Number_of_days_ of_warning_befo re_password_exp ires = 14
I have a couple python scripts that can read me the sections, and items but I'm not sure how to generate what I need using an if statement for both parameters.
Here is what the config file looks like:
[user1]
Last_password_c hange = password_must_b e_changed
Password_expire s = never
Password_inacti ve = never
Account_expires = never
Minimum_number_ of_days_between _password_chang e = 7
Maximum_number_ of_days_between _password_chang e = 90
Number_of_days_ of_warning_befo re_password_exp ires = 14
I have a couple python scripts that can read me the sections, and items but I'm not sure how to generate what I need using an if statement for both parameters.
Comment