I have a bash script that just needs to add a new user and sign the password that is passed when the script is called:
./adduser_script username password
and then the password is used as a parameter in the script as follows:
/usr/sbin/useradd ... -p `openssl passwd -1 "$2"` ...
The problem arises, of course, when the password contains special characters, such as $ @ , $ * itd. Therefore, when I call the script:
/adduser_script username aa$@bbb
and after the script, the completion of the password looks like this: aabbb (so special characters are removed from the original password). The question is, how to correctly pass the original password using special characters in the script?
Thanks in advance, Relations
source
share