Reputation: 3
Sorry if I'm going down the wrong path... I tried to search for a solution for the past couple days, and not sure if I'm searching the right topic.
I'm trying to do an useradd script, and I'm getting close. However, I'm stuck on the following:
>>> HASH_PASSWORD = '$1$AMWteFb7$pD/0oisRcD.6lSvtrjNmb1'
>>> print HASH_PASSWORD
$1$AMWteFb7$pD/0oisRcD.6lSvtrjNmb1
>>> HASH_PASSWORD = HASH_PASSWORD.replace("\$","\\\$")
>>> print HASH_PASSWORD
$1$AMWteFb7$pD/0oisRcD.6lSvtrjNmb1
I just need to add a "\" in front of the "$". Can't seem to find a way to do that.
Thanks in advance for all your help.
Upvotes: 0
Views: 96
Reputation: 47993
It has to be
>>> HASH_PASSWORD = HASH_PASSWORD.replace("$","\\$")
>>> print HASH_PASSWORD
\$1\$AMWteFb7\$pD/0oisRcD.6lSvtrjNmb1
Upvotes: 2