How do I set the root password in a kickstart file?

Solution Verified - Updated -


  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 8


  • How to create an encrypted password that is suitable for use in a kickstart file.


  • There are two options:
  1. Set the password in plaintext in the kickstart using the rootpw option, but leaving out the --iscrypted flag. While it is unencrypted in the kickstart file it will be encrypted on the installed system in /etc/shadow.

  2. Follow Solution 221403 to generate a hashed password then pass the resulting string to the rootpw --iscrypted option in the kickstart.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.


no details in here so nothing useful. this is not a true or false question.

For RHEL8 the encrypted password can be generated with:

python -c 'import crypt,getpass;pw=getpass.getpass();print(crypt.crypt(pw) if (pw==getpass.getpass("Confirm: ")) else exit())'

As described in: