Operating System - HP-UX
1833162 Members
3629 Online
110051 Solutions
New Discussion

Command to set "date password last changed" of an user? (password aging enabled)

 
Markus Braune
Occasional Contributor

Command to set "date password last changed" of an user? (password aging enabled)

Hi,

I searched the manpage of passwd and the web if there is a command to edit the “date password last changed” of an user in /etc/passwd (HP-UX 11.23, non trusted). When I change the password by "passwd user" I can see the date last changed for example by “passwd –s user”. I am also able to edit this date manually in /etc/passwd (last two characters in pw column).

But is there also a command to edit that "date password last changed"?

I’d like to do that for some training users automated in a script from time to time (like the password was changed 12 weeks ago). If there is no command, what’s the correct way to edit /etc/passwd?

cp /etc/passwd /etc/ptmp
sed ‘s/^user:\([^,]*\),[^:]*:/user:\1,o.zT:/" /etc/passwd > /etc/ptmp
mv /etc/ptmp /etc/passwd

Is that the correct procedure?
I think the advantage of a command would be the automated check & lock of the passwd file.

Thanks for all your hints.
2 REPLIES 2
Steven E. Protter
Exalted Contributor

Re: Command to set "date password last changed" of an user? (password aging enabled)

Shalom,

Take a backup of /etc/passwd before you try this.

passwd -x username

Will set your users up to expire somewhat more safely.


SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Dennis Handly
Acclaimed Contributor

Re: Command to set "date password last changed" of an user? (password aging enabled)

>I think the advantage of a command would be the automated check & lock of the passwd file.

Yes. The command is vipw(1m).
But you are own your own to figure out the password expiration encoding.
I have a program to display them, not to create them.