LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   "chage" command query (https://www.linuxquestions.org/questions/linux-newbie-8/chage-command-query-923538/)

sheelavantar 01-12-2012 11:39 PM

"chage" command query
 
Hi All,
I would like to know the meaning of "chage -M 0".

When maxdays value is set to zero for a perticular user password, the "chage -l" command shows that the password will never expire. But it's getting expired in 24 hours.

1.Then waht is the meaning of this value zero here?

2.what is the range for MAXDAYS ?

3. How can disable password expiry for a perticular user using this command?

Please help me find the answers for my questions.

Thank You.
Warm Regard,
Vijay S.

Dark_Helmet 01-12-2012 11:46 PM

The questions you present sound like "theoretical" questions--as though someone is trying to make sure you understand how a command works. And that's usually in an instructional environment. I could be wrong, but because that's my impression, I'll give you a link. All your questions can be answered by reviewing the

chage(1) man page

If, after you read that page you still do no know the answers or do not understand what the man page is saying, post back with a question describing what you don't understand.

EDIT:
Some egg on my face... the man page does not specify what the absolute maximum value of MAXDAYS can be, but I've got a strong suspicion what it is...

sheelavantar 01-13-2012 12:22 AM

Thanx for your reply.

I have understood the command. when I set the MAXDAYS as zero, the password will be valid for 24 hours, because after 24 hours only the MAXDAY value will become 1Day and the password/account will not be active after that.

But I am confused by the output of "chage -l" command.

please check the below output.
bash-2.05a# chage -M 0 vijay
bash-2.05a# chage -l vijay
Minimum: 0
Maximum: 0
Warning: 7
Inactive: 0
Last Change: Jan 14, 2012
Password Expires: Never
Password Inactive: Never
Account Expires: Never
bash-2.05a# date
Fri Jan 13 20:12:38 LST 2012
bash-2.05a#

Even though the password/account will be active for next 24 hours the "chage -l" command shows that the password will Never expire. which is wrong.

Please let me know your opinion.

Dark_Helmet 01-13-2012 12:44 AM

Well, that specific problem does not occur on my system (Debian 6.0.3):
Code:

root@localhost# chage -l nobody
Last password change                                        : Nov 17, 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
root@localhost# chage -M 0 nobody
root@localhost# chage -l nobody
Last password change                                        : Nov 17, 2011
Password expires                                        : Nov 17, 2011
Password inactive                                        : never
Account expires                                                : never
Minimum number of days between password change                : 0
Maximum number of days between password change                : 0
Number of days of warning before password expires        : 7
root@localhost# chage -M -1 nobody
root@localhost# chage -l nobody
Last password change                                        : Nov 17, 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                : -1
Number of days of warning before password expires        : 7
root@localhost# chage -M 99999 nobody
root@localhost# chage -l nobody
Last password change                                        : Nov 17, 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

Based on the text of the chage man page, using "-M 0" essentially says that the next time the user logs in, they need to change their password. The fact that your system does not seem to recognize that change until the next day implies (to me) that your system probably has a daily scheduled job to check user password status. Such a situation would also explain why your "chage -l" commands to not reflect a change from "never"--because the password information may not be updated.

Keep in mind, that is speculation on my part. The output of your chage command does not match mine. The behavior of your chage does not match mine. By definition, all I can do is speculate as to why your system is behaving the way it is when I have no way to reproduce it on my end.

EDIT:
I wanted to find out what version of chage comes with Debian 6.0.3 so I did a Google search. I did not find that specific information, but I did find an old Debian bug report. The bug report is not directly relevant to your problem. However, if you look at the responses to the bug, there is an indication that PAM modules may be involved. So that is another avenue for you to consider for your behavior: PAM config.

deep27ak 01-13-2012 06:24 AM

Quote:

Originally Posted by sheelavantar (Post 4573343)
Thanx for your reply.

I have understood the command. when I set the MAXDAYS as zero, the password will be valid for 24 hours, because after 24 hours only the MAXDAY value will become 1Day and the password/account will not be active after that.

But I am confused by the output of "chage -l" command.

please check the below output.
bash-2.05a# chage -M 0 vijay
bash-2.05a# chage -l vijay
Minimum: 0
Maximum: 0
Warning: 7
Inactive: 0
Last Change: Jan 14, 2012
Password Expires: Never
Password Inactive: Never
Account Expires: Never
bash-2.05a# date
Fri Jan 13 20:12:38 LST 2012
bash-2.05a#

Even though the password/account will be active for next 24 hours the "chage -l" command shows that the password will Never expire. which is wrong.

Please let me know your opinion.

Are you sure you are running the command properly?
which distro are you using?

As your date is also showing the wrong one. 14th which is supposed to be tomorrow?

here I did the same in my Redhat 5.2 and this is the output

Code:

#chage -M 0 deepak
#chage -l deepak

Last password change                                    : Jan 13, 2012
Password expires                                        : Jan 13, 2012
Password inactive                                      : never
Account expires                                        : never
Minimum number of days between password change          : 0
Maximum number of days between password change          : 0
Number of days of warning before password expires      : 7


sheelavantar 01-15-2012 08:04 PM

Thanx for the replies,
I tested the same on fedora 10 machine and it is working properly.
Now I have to check it on the target system, why it is showing wrong info.

@Deepak: I had changed the system date for testing... that's not a problem.

Thank You guys,

Warm Regards,
Vijay S.


All times are GMT -5. The time now is 11:02 PM.