Section Number and Name:
23.3.2. Kickstart Commands and Options
Describe the issue:
when describing --iscrypted option, this piece of code is suggested to get the password hash:
$ python -c 'import crypt; print(crypt.crypt("My Password"))'
The issue with this code is that the "My Password" string will be recorded in bash history.
Suggestions for improvement:
This not-so-elegant one-liner will ask twice for password on standard input and it will print the hash only when the two passwords match, eliminating both traces of password on disk and most typos:
python -c 'import crypt,getpass;pw=getpass.getpass();print(crypt.crypt(pw) if (pw==getpass.getpass("Confirm: ")) else exit())'