带有私钥的子进程 python 的 SCP
Scp with subprocess python with a private key
如何为 python 子进程转换此 scp 命令。
scp -i /home/ramesh7128/Downloads/<private_key>.pem /home/ramesh7128/Downloads/testing_transfer.py <remote_add>:<remote_file_path>
尤其是包含私钥路径的部分是我遇到问题的地方。
确保您包括了远程计算机上的用户并且您的格式正确:
scp -i /home/ramesh7128/Downloads/<private_key>.pem /home/ramesh7128/Downloads/testing_transfer.py <remote_user>@<remote_add>:<remote_file_path>
scp -i private_key.pem /path/to/the/local/file root@server.com:/path/to/the/remote/file
编辑:(来自评论)
subprocess.Popen(["scp", "-i", "path/to/private_key.pem", myfile, destination])
此语法让 Popen 了解 -i
选项。
如何为 python 子进程转换此 scp 命令。
scp -i /home/ramesh7128/Downloads/<private_key>.pem /home/ramesh7128/Downloads/testing_transfer.py <remote_add>:<remote_file_path>
尤其是包含私钥路径的部分是我遇到问题的地方。
确保您包括了远程计算机上的用户并且您的格式正确:
scp -i /home/ramesh7128/Downloads/<private_key>.pem /home/ramesh7128/Downloads/testing_transfer.py <remote_user>@<remote_add>:<remote_file_path>
scp -i private_key.pem /path/to/the/local/file root@server.com:/path/to/the/remote/file
编辑:(来自评论)
subprocess.Popen(["scp", "-i", "path/to/private_key.pem", myfile, destination])
此语法让 Popen 了解 -i
选项。