Get date last modified password

Hello,

I would like to retrieve the date of the last modification of the password
Only I failed with one of the commands
yunohost user {list,create,delete,update,info,export,import,group,permission,ssh}

Is it possible ? If so, do you have an idea for me?

Thanks for your help,
best regards

Yep
Perhaps by using history command

Before, export this var to add the date to the output

HISTTIMEFORMAT="%d/%m/%y %T "

And after the command history should display the date now.

So after, you can add a pipe to the history command. For example :

history | grep passwd

And now you should have got the last hystory commands and their dates

If you want to use this var all the time, you can add it to your .bashrc. (Think to re source it after)

echo 'export HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bashrc 
source ~/.bashrc 

Nice

That’s probably not reliable because YunoHost users don’t have SSH access by default and are more likely to change their passwords from the user portal …

The real question is “why do you need this info”

And I suspect the answer is “because I want to make sure my users change their password”, and then the answer to this is “there are already ways to achieve this without reinventing the wheel” >_>

Hello,

Thank you both for your help.

I need to retrieve this date to sync passwords with other apps.

In short I will proceed whether there is a modification of the password on one side or the other to be able to update the password in the application which is no longer up to date.

This makes it possible to have a single and unique password for the user.

In order to be able to make this comparison, I need to know the date of the last modification which will be recorded in a reference table and will make it possible to evaluate whether or not the password must be updated.

Best regards,

From what I see

It seems quite possible to create or modify a user and its password with the yunohost commands.

Best regards,

I guess you could use the “modifyTimestamp” from LDAP :

cf this snippet :

slapcat | grep "dn: uid=johndoe" -A38 | grep "^dn:\|modifyTimestamp"
dn: uid=johndoe,ou=users,dc=yunohost,dc=org
modifyTimestamp: 20221126163221Z