How to Create an Encrypted Password

# echo -n admin123 | makepasswd --crypt-md5 --clearfrom -
admin123     $1$ZUNNSLzQ$XsViFC1bhucsr3f8AzMPt/

As commented bellow this command is unsecure. True method - write password in file with text editor, and read password from file.


Another way is this: openssl passwd -1 -stdin <<< password_here

This does not show the password on the process list. For more options see openssl passwd --help


Your method doesn't work because makepasswd doesn't accept a password as argument, you should create a temporary clear text file instead to make the password if you want to generate the hash based on a password:

➜  ~  makepasswd --crypt-md5 --clearfrom file
admin123   $1$iQd/ujH.$rMXZiYwQC1Rc/rgO3.FeX/  

Of course, do not use the command line to store the password as it will be accessible by anyone that can read your command history or process arguments.