Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've changed my password to X and the shadow file has changed to:


I see the encrypted X as $1$oYINSKjP$eCkCtJV/2dXerAD57WQPj/. How can I retrieve the encrypted X without changing the password? openssl or any other command to use?

share|improve this question
up vote 7 down vote accepted

Your password isn't encrypted. It is hashed.

A salted MD5 hash has been generated and written to /etc/shadow. You cannot retrieve original value.

The original value X has been hashed in this format: $id$salt$encrypted - id == 1 stands for MD5 (see NOTES on manpage of crypt(3))

share|improve this answer
Thanks. Now how can I hash X into $id$salt$encrypted on the command line? – ahmad Dec 5 '12 at 12:43
openssl passwd -1 -salt salt password – otokan Dec 5 '12 at 12:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.