Reputation: 1707
On CentOS 7, I'm trying to create a shell script which will be executed by PHP that will allow me to login using CentOS User.
Below is the Hash password that I got from /etc/shadow
root:$6$LsCK1WmouFiO9AT/$.srI2tX1NXWpO0PSqaoB06hi0mvJ59Z3G4VpzT.3481gLNVvO6EPpsIaUkB5E/m8EZvMKXui.5GySJJ618.H8.::0:99999:7:::
This is the breakdown
Algorithm: sha512
Salt: LsCK1WmouFiO9AT/
hash: .srI2tX1NXWpO0PSqaoB06hi0mvJ59Z3G4VpzT.3481gLNVvO6EPpsIaUkB5E/m8EZvMKXui.5GySJJ618.H8.
How would I generate a password that will match the hash?
Upvotes: 0
Views: 127
Reputation: 3691
You can use Python 3 and greater to generate the hash password.
python -c 'import crypt; print crypt.crypt("MyPassword", "$6$RandomSalt/$")'
Change MyPassword
to your plain text password and $RandomSalt
to the salt you have.
By running the above you will get something like
.srI2tX1NXWpO0PSqaoB06hi0mvJ59Z3G4VpzT.3481gLNVvO6EPpsIaUkB5E/m8EZvMKXui.5GySJJ618.H8.
Now you can glue them together using $
so it will become
$6$LsCK1WmouFiO9AT/$.srI2tX1NXWpO0PSqaoB06hi0mvJ59Z3G4VpzT.3481gLNVvO6EPpsIaUkB5E/m8EZvMKXui.5GySJJ618.H8.
Upvotes: 1