Source code for the accompanying tutorial found here: https://hackersandslackers.com/ssh-scp-in-python-with-paramiko/
$ git clone https://github.com/hackersandslackers/paramiko-tutorial.git
$ cd paramiko-tutorial
$ make install
$ make run
Replace the values in .env.example with your values and rename this file to .env:
ENVIRONMENT
: Contextual environment the script is being on.SSH_REMOTE_HOST
: IP address (or URL) of remote host to SSH into.SSH_USERNAME
: Username for connecting to remote host.SSH_PASSWORD
(optional): Password of user SSHing into remote host via basic auth.SSH_KEY_FILEPATH
: /path/to/local/sshkeySCP_DESTINATION_FOLDER
(optional): Remote directory to serve as destination for file uploads.
Remember to never commit secrets saved in .env files to Github.
Hackers and Slackers tutorials are free of charge. If you found this tutorial helpful, a small donation would be greatly appreciated to keep us in business. All proceeds go towards coffee, and all coffee goes towards more content.