When we use Red Hat Kickstart scripts or useradd or other means of writing, we often need to use the crypt command to encrypt the generated password format. So, is there any other way to generate passwords in this format? In fact, there are many ways.
We can use the mkpasswd command: This command is used to generate passwords in crypt format:
mkpasswd
After entering the command, the program will ask for a password and then generate A string in crypt format.
If you use Apache web server, you can also use htpasswd:
htpasswd -nd user
User name (user) does not matter, we are concerned about passwords. This command will output a string in the form of user:password, and copy the password field directly to ok.
If you have OpenSSL, you can use the openssl command:
openssl passwd -crypt myPassword
Replace the myPassword in the above command with the password string you want to use.
There are other ways to enter commands directly on the command line, but there is a problem with this method, that is, the password can be seen in the ps command, and the password will be recorded in the shell history.
But there is a solution to this problem: use a script, or a language interpreter.
For example, use Perl:
perl -e "print crypt('password','sa');"
Perl needs an encrypted salt, as used here Sa (salt refers to the random string used in encryption, with different salts can generate different encryption results).
Ruby also needs to encrypt salt:
ruby -e 'print "password".crypt("JU"); print("\ ");'
PHP can also be:
php -r "print(crypt('password','JU') . \\"\ \\");"
Note that if you do not use an encryption salt (such as JU in the above command), the output string will not be in crypt encryption format, but in MD5 encryption format. Therefore, the encryption salt is actually a necessary parameter.
Python needs to import the crypt library and use the encrypted salt:
python -c 'import crypt; print crypt.crypt("password","Fx")'
The encrypted salt here is Fx.
The database can also generate crypt passwords. For example, use MySQL:
echo "select encrypt('password');" |
Mysql
In addition, Tcl, trf under Ubuntu, and Lua's lua-crypt plugin can achieve the same purpose.
Welcome to add other ways!
First, what is haproxyHAProxy provides high availability, load balancing, and agents based on TCP a
1. Start/stop/restart of VNC #service vncserver start/stop/restart Close the specific vncserver comm
You all know what an IP address is, right? They are assigned to devices on the network to represent
According to statcounter statistics, the global operating system market share in March is still Win7
How to build l2tpd vpn server with centOS5.5
Intel bsf instruction using tutorial
Linux shell script preparation tutorial
How to uninstall software under Linux
Introduction to the configuration method of VPN server under Linux operating system
How to make Linux support ASP/ASP.NET diagram detailed tutorial
Redis.conf configuration file details
Expired file causes VCS dual machine to fail to start
In-depth study on Lvs scheduling strategy
How to solve the problem that the Linux operating system can't find the network card
How to view the wifi password in win10? Win10 view Wifi password method
Some secrets you don't know about my documents
How to set the win7 taskbar to transparent
How to upgrade win10 system to win10 1049 version?
Is it possible for my computer to change the graphics card to play LOL FPS can improve
What should I do if the Windows 7 screenshot has a black screen?
Tips: Backup personal settings for Pinyin Plus
How to solve the CPU usage of WinXP system svchost.exe?