gen-shadowpass.py
from crypt import crypt
method_num = 6 # SHA-512
salt = "chihaya" #
password = input("password: ")
print(crypt(password, "${num}${salt}".format(num=method_num, salt=salt)))
Run in Shell
$ python3 gen-shadowpass.py
password:Anything is fine
$6$chihaya$moeYHfUnBzrGnBo0qcZ.ExPeYgFtjIFhc8BR1jnE.1DMXU7waByCOVSOY2vY3qwOh9BHybqZ84nY/8tQLGrnk/
You can forcibly change the password by writing the above character string in / etc / shadow. Ubuntu 12.04 seems to use 8 characters for salt. Well, I don't think anyone would do that.
Recommended Posts