I want to know if it’s possible to decrypt user password in /etc/shadow ?
No, should not be. Password systems use hashing algorithms (usually with “salt” to prevent guessing), to prevent people from doing exactly that. The conversion to a hash is a one-way conversion.
Thank you for reply Rob.
If a user forgot his password, how to retrieve it ?
He doesn’t. You reset the password to something he knows, or you let him reset it himself (say using a one-time password link).
How to reset it because with the command passwd, the system require the current user password?
Please look over man passwd: you can pass the login-name of the user, and use the -e
argument to force the user to change the password immediately. That’s one way to do it.
As you can see on the screenshot, when I tried with -e option only the user current password work but I can’t change it.
Are you user mala? It’s not a problem with passwd; it’s that you’re not in the sudoers file. If you don’t know mala’s password, either you need to use an account where you know the password, or you’re sunk.
If you have a Linux system and you’ve locked yourself out of it, you’re going to probably have to recreate the system. There’s a reason you’re supposed to remember passwords, you know
Try booting to single user or emergency mode. You should be root then and can reset root and other passwords.
Yes I am mala. I know mala password but I want to change it.
Is possible to add mala in sudoers file and change his password ?
You can change your password by simply doing “passwd”; you’ll be asked for the “mala” password, and you will be asked for the new password you want. That part works fine.
If mala is not already in sudoers, then you won’t be able to change a root-owned file like sudoers. In any case, you’d normally use “visudo” to change sudoers, since it’s a very sensitive file and visudo prevents you from breaking the system. But if you’re not in sudoers, you won’t be able to do that – someone with root access to your system would be needed to do that.
I would just try to do “sudo -i” – if it works, you’re already in sudoers. If it doesn’t, you’ll need a system admin, or “break into” your system in the manner that @Alistair_KodeKloud suggests.