I'm trying to run an
scp (secure copy) command using
subprocess.Popen. The login requires that I send a password:
from subprocess import Popen, PIPE
proc = Popen(['scp', "[email protected]:/foo/bar/somefile.txt", "."], stdin = PIPE)
This immediately returns an error:
[email protected]'s password:
Permission denied, please try again.
I'm certain the password is correct. I easily verify it by manually invoking
scp on the shell. So why doesn't this work?
Note, there are many similar questions to this, asking about
subprocess.Popen and sending a password for automated SSH or FTP login:
How can I set a users password in linux from a python script?
Use subprocess to send a password
The answer(s) to these questions don't work and/or don't apply because I am using Python 3.