8

The instructions for auto install of ubuntu 20.4 talks about an encrypted password $crypted_pass.

version: 1
identity:
    hostname: hostname
    username: username
    password: $crypted_pass

how do I generate this for any given password? I've tried a straight sha-512 hash but this doesn't work

From these instructions it appears I should get

$6$FhcddHFVZ7ABA4Gi$9l4yURWASWe8xEa1jzI0bacVLvhe3Yn4/G3AnU11K3X0yu/mICVRxfo6tZTB2noKljlIRzjkVZPocdf63MtzC0

for root but the sha-512 hash of root is

99ADC231B045331E514A516B4B7680F588E3823213ABE901738BC3AD67B2F6FCB3C64EFB93D18002588D3CCC1A49EFBAE1CE20CB43DF36B38651F11FA75678E8
Kulfy
  • 18,154

1 Answers1

11

The crypted string that you get will depend on the salt value - to reproduce the one in the example you would need to duplicate its 16-character salt:

$ printf 'root' | openssl passwd -6 -salt 'FhcddHFVZ7ABA4Gi' -stdin
$6$FhcddHFVZ7ABA4Gi$9l4yURWASWe8xEa1jzI0bacVLvhe3Yn4/G3AnU11K3X0yu/mICVRxfo6tZTB2noKljlIRzjkVZPocdf63MtzC0

See also:

steeldriver
  • 142,475