0

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.

1 Answer 1

2

It has to be

>>> HASH_PASSWORD = HASH_PASSWORD.replace("$","\\$")
>>> print HASH_PASSWORD
\$1\$AMWteFb7\$pD/0oisRcD.6lSvtrjNmb1
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you so much. I will now go bang my head against the wall for not realizing that. ^_^

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.