I’m using Python subprocess to run a command on a remote server:
p=subprocess.Popen('ssh blah@foo.com "sudo do_something"', shell=True)
When I type the password, it appears on the screen – as opposed to running this from the shell, where the password is hidden.
Is there a way to disable this input echo?
You might want to consider using pexpect if you have to type something that should be automated: http://www.noah.org/wiki/Pexpect
This way you can ask your user in advance for the password (using the getpass module), and then let your script “type” the password virtually.
There are a couple of well written examples on the website mentioned above describing how to do what you need.