I'm very new to the RPi world. I have a Raspberry Pi Zero and I want it to send a file via SCP to my Windows computer.
I can enter my RPi via SSH from my PC and I can extract files from it and move them to my PC via SCP.
I've also created a program in Python using Paramiko to extract files from RPi. The program has to be executed in my PC.
import paramiko
#Connect my PC to my RPi via SSH
ssh_client = paramiko.SSHClient()
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh_client.connect("00.00.000.000", port = 0, username = "username",password="password")
#Move file from RPi to my PC
ftp_client=ssh_client.open_sftp()
ftp_client.get("path_file_in_RPi","path_destination_in_PC")
ftp_client.close()
But what I want now is (using Python and Paramiko if possible) to move a file from my RPi to my PC but connecting my RPi to my PC instead of my PC to the RPi. I could access my RPi from my PC using SSH and then execute this program inside RPi and have my RPi connect to my PC and transfer some files automatically.
How can I do this? I've read that I have to generate a SSH server in my computer. What does that mean? Having a link between my PC and my RPi is not enought? If so, how do I create that server on my Windows machine? and what commands should the python script inside my RPi should have as to call my PC to send files to it instead of me from the PC to call the RPi and transfer those same files to my PC?
cp /path/to/file/on/Pi /mnt/WindowsShare/SubDir
.