I’ve been looking at puppet these two days, and I’m going to use this to manage the work of adding, assigning and deleting users of my system. However, it’s a bit too troublesome to use the passwd command of the system to generate user passwords every time. I found it on the Internet, and I can generate the password of Linux system users saved in shadow through Perl, as shown below.

Perl – E ‘print crypt (“88991026”, q ($1 $acwlbgo)), “n” \ \ where 88991026 is the password to be set for the user, the $1 $acwlbgo string is a custom string, which is usually followed by 8 characters in shadow.

The generated password string style is as follows:


There’s a $, salt in the front and encrypted value in the back. They are called hash
Crypt itself uses DES algorithm by default
Use MD5 algorithm if salt starts with $1 $

The DES algorithm command is as follows:

perl -e ‘print crypt(“88991026″,”/g”),”\n”‘

The generated password string style is as follows: