1

I'm looking to create a md5 hash to use in /etc/shadow. Someone suggested using grub-crypt. Every time I put the same password in I get a different hash.

[root@endpoint ~]# grub-crypt --md5
Password: 
Retype password: 
$1$dd3MRM3g$WZkIt4KDQgrKZ4D1d71dz1
[root@endpoint ~]# grub-crypt --md5
Password: 
Retype password: 
$1$Z5XNluIC$bt1In4cu5qdCKPMCf1lV71
[root@endpoint ~]# 

I believe this is because of the salt.

from man crypt

So $5$salt$encrypted is an SHA-256 encoded password and $6$salt$encrypted is an SHA-512 encoded one.

but what if I don't want to use a salt is that possible to store something in /etc/shadow without it ?

Assuming I wanted to use

[root@endpoint ~]# echo -n mypassword | md5sum 
34819d7beeabb9260a5c854bc85b3e44  -
[root@endpoint ~]# 

Question

What should /etc/shadow look like if I don't use the salt ? Or by design will it never work ? I'm aware its less secure.

[root@endpoint ~]# grep someaccount /etc/shadow
someaccount:$1$34819d7beeabb9260a5c854bc85b3e44:16494$:0:99999:7:::
[root@endpoint ~]# 

Thanks

  • "I'm looking to create a md5 hash to use in /etc/shadow." A reasonable question is, why? What are you trying to do? – Faheem Mitha Mar 11 '15 at 3:37
  • I just want to know. I'm not trying to do anything I just want to know how to make it work without the salt or indeed whether its possible. – user610209 Mar 11 '15 at 3:46
  • The system does something like that when creating an account, and even when changing a password. You could take a look at how this is done when creating an account. So you could look at adduser or useradd or passwd and work downwards. – Faheem Mitha Mar 11 '15 at 3:48
  • Question What should /etc/shadow look like if I don't use the salt ? Or by design will it never work ? I'm aware its less secure. – user610209 Mar 11 '15 at 4:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.