Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Send file over SSH #81

Open
felipe88alves opened this issue Oct 25, 2022 · 0 comments
Open

Send file over SSH #81

felipe88alves opened this issue Oct 25, 2022 · 0 comments

Comments

@felipe88alves
Copy link

Wondering if there's any way to send a file over SSH.
I'm working with automation of configuration using NETCONF, and need to send over a file with the configuration and subsequently respond to prompts.

More specifically, I need to run the following SSH command:
ssh -o StrictHostKeyChecking=no -p $PORT admin@$HOST -s netconf < $CONFIG_FILE

The python pexpect package allows the spawning of a command to be executed. So I could perform the following:

cmd_to_execute = f'/bin/bash -c "ssh -o StrictHostKeyChecking=no -p {cm_port} admin@{cm_host} -s netconf < {config_file}"'
child = pexpect.spawn(cmd_to_execute)

What would be an equivalent goexpect way of performing such action?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant