I have a Python script which uses sshpass
for ssh access to a machine
Popen(["sshpass","-p", "test!@#", "ssh", "-o UserKnownHostsFile=/dev/null", "-o StrictHostKeyChecking=no", "[email protected]"])
But due to the presence of special characters in password field this command is throwing some error. Is there a way that I can use password with special characters in sshpass or anything else which can be called from Python?
The error is: bash: !@#": event not found
Escape character worked in my case. Simply use \
character before '!' or other special characters.