subprocess run scp identity file not accessible

Viewed 198

So I can scp a file to my aws instance but when I run scp from python using

subprocess.run(["scp", "-vvv", "-i /home/me/mine/mine.pem", "/tmp/testfile.txt", "ec2-user@55.55.55.55:~"], cwd="/home/me/mine")

I get Warning: Identity file /home/me/mine/mine.pem not accessible: No such file or directory.

Why is this and how can I fix this problem?

My local OS is ubuntu 18.04.5 LTS

1 Answers

Obviously, your argument "-i /home/me/mine/mine.pem" should be two arguments:

subprocess.run(["scp", "-vvv", "-i", "/home/me/mine/mine.pem", "/tmp/testfile.txt", "ec2-user@55.55.55.55:~"], cwd="/home/me/mine")
Related