D
Deleted member 65953
Guest
I know that it is possible to set user passwords programmatically using
Generate encrypted password:
Set encrypted password:
Questions:
1. Is there a more straightforward way to generate the encrypted password instead of the solution shown above which involves two pipes?
2. Is it secure to place the encrypted password into a version-control system along with other shell scripts that I use for system management? The plaintext password cannot be retrieved from the encrypted password, correct?
echo 'mypassword' | pw usermod myuser -h0
. However, this exposes the plaintext password (e.g. in ps
and when the command is included in a shell script under version control). The alternative is to generate an encrypted password from the plaintext password, and programmatically set the encrypted password.Generate encrypted password:
Code:
# echo 'mypassword' | pw usermod nobody -N -h0 | cut -d : -f 2
$6$07r1vTa8eEhfGRKu$8kzORlnaPhH47akHNZsox6CCV14l1NKe1YV8FblEEjlSkj21OjHNKGeagZt8w0Pe28JUxY121Q73RP/oUex3i1
Set encrypted password:
Code:
# echo '$6$07r1vTa8eEhfGRKu$8kzORlnaPhH47akHNZsox6CCV14l1NKe1YV8FblEEjlSkj21OjHNKGeagZt8w0Pe28JUxY121Q73RP/oUex3i1' | \
pw usermod myuser -H0
Questions:
1. Is there a more straightforward way to generate the encrypted password instead of the solution shown above which involves two pipes?
2. Is it secure to place the encrypted password into a version-control system along with other shell scripts that I use for system management? The plaintext password cannot be retrieved from the encrypted password, correct?