'How to copy a file between two remotes using fabric with password authentication?
The idea is to, using fabric, copy a file from a remote accessed via gateway (let's call it "remote") to the remote used as gateway (called "gateway"), directly, without copying it to the local machine via get and then uploading it to the gateway server via put.
The solution presented in Using fabric to copy file from one remote server to another remote server? does not work for me because I need to do it over password authentication.
Maybe the parameter forward_agent in Connection object could help - I didn't understand from the documentation (source: https://docs.fabfile.org/en/2.6/api/connection.html#fabric.connection.Connection).
Code:
from fabric import Connection
gateway_host = ''
gateway_user = ''
gateway_password = ''
remote_host = ''
remote_user = ''
remote_password = ''
gateway = Connection(
host = gateway_host,
user = gateway_user,
connect_kwargs = {"password": gateway_password},
)
remote = Connection(
host = remote_host,
user = remote_user,
connect_kwargs = {"password": remote_password},
gateway = gateway,
)
# I want to be able to send a file from remote to gateway, directly.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
