Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: How to encrypt user password  (Read 1393 times)

0 Members and 1 Guest are viewing this topic.

joseletk

  • Guest
How to encrypt user password
« on: March 07, 2018, 11:14:30 pm »
Use encrypted passwords to automatically setup users using configuration management tools like Puppet or Ansible.

Install whois package.

Code: [Select]
$ sudo apt-get install whois
Encrypt password using DES algorithm with random salt.
It uses only the first 8 characters of the password.

Code: [Select]
$ printf "badpassword" | mkpasswd --stdin --method=des
Nw8.4ABfIKZKM

Encrypt password using DES algorithm with defined salt.
It uses only the first 8 characters of the password.

Code: [Select]
$ printf "badpassword" | mkpasswd --stdin --method=des --salt="AA"
AAEZq.zBgmGCM

Encrypt password using MD5 algorithm with random salt.

Code: [Select]
$ printf "badpassword" | mkpasswd --stdin --method=md5
$1$RcMgFRVJ$Pq3G.LQ0iwuP5M2dWNLzo1

Encrypt password using MD5 algorithm with defined salt.

$ printf "badpassword" | mkpasswd --stdin --method=md5 --salt="UeUn9t3A"
$1$UeUn9t3A$oEb0prxivWfmh41.YpLJu.

Encrypt password using SHA256 algorithm with random salt.

Code: [Select]
$ printf "badpassword" | mkpasswd --stdin --method=sha-256
$5$2inx/2oOXZ/hMl$3oTqVmBtiFJ/2je9MM.JplWfLjnf.RaVeg9e7eQbCKC

Encrypt password using SHA256 algorithm with defined salt.

Code: [Select]
$ printf "badpassword" | mkpasswd --stdin --method=sha-256 --salt="U7ReiUGcnY9yt3A1"
$5$U7ReiUGcnY9yt3A1$3Bfm1gV9RMLMjZs2ATRX3DtxKCYOdN3ykVSKWEpQwE5

Encrypt password using SHA512 algorithm with random salt.

Code: [Select]
$ printf "badpassword" | mkpasswd --stdin --method=sha-512
$6$YfQbudiFYdPl$8Byyl7mpwmDJRTChzRa2cCXqFKbZ23bgUuoGqgqFTAMsdJkiqreLUwiRaVOmIjpM5X0qUP83W9m1xq9EwALKZ.

Encrypt password using SHA512 algorithm with defined salt.

Code: [Select]
$ printf "badpassword" | mkpasswd --stdin --method=sha-512 --salt="g3RYi6b0nk9y43Rl"
$6$g3RYi6b0nk9y43Rl$k89OM4kjLkqGcbJi/G2y8AO3CooJQgH5j2M8azymZzliVIaELbhixDPSSf.OlepYN6TVJxKgDLX4dsJtNdJ7R/

====================================================================================================