To set a password directly to an hash i used gsed so far for a long long time. But you never stop to learn. There is a much simpler way. My colleague Detlef Drewanz pointed me to it today : passwd -p <hash> <username>

For example to change my password to changeme123 you use it like this:
#passwd -p $5$xNBPFJQV$78dY0NKeIeF1gHu1LfKIqSodQT.dC.aKMkcbCt9CMl7 jmoekamp
Obviously the usual objections apply:
-p hash
           Specifies  the  exact string value to be placed in the shadow pass-
           word field. The user must have both the  solaris.passwd.assign  and
           solaris.passwd.nocheck  authorizations.  It  is intended to be used
           for scripting password hash updates. Its use is generally  discour-
           aged,  as  the  hashed  password is visible through ps(1) while the
           command runs.
This works in Solaris since Solaris 11.3 SRU 4.

1 Comment


  • John Cawley  
    Useful, but I escaped the $. Thanks.

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.