02-05-2025 05:55 AM - edited 02-05-2025 06:19 AM
@Ricaru52 wrote:
Thanks for the response NIquist, I didn't specified the porpoise of this program, as I said to another user, the problem is that I'm building a half industrial program, but It won't be installed or used in my company. We will handle it to another company, and we want to work as a "black box". When they send a specific commands by TCP, our program has to return the measurement files in the specified file.
I have admin right but only in our PC, not in the network or the future network.
in windows 11, you can use scp diretly in powershell or cmd to transfer files to another computer.
if in the same network eg host 192.168.167.1 (user alice), target 192.168.167.2 (user bob)
in the user directory, the user usually doesn't need priviled rights to copy files
the users do not need to be actively logged in for SCP to work. As long as the SSH service is running on the target machine and you have the correct login credentials, you can transfer files. You'll just need the target user's account and password. The target machine should be powered on and connected to the network.
However, you will be prompted to enter the password for the user Bob on the destination PC (windows host) right after you run the scp
command.
In general, SCP does not support entering passwords programmatically due to security reasons.
However, you can achieve passwordless SCP transfers by using SSH key-based authentication.
1. Generate SSH Key Pair on Windows Host
2. Copy the Public Key to Target
If successful, you won’t be prompted for a password.
------------------
now the actual commands:
scp C:\Users\alice\Documents\file.csv bob@192.168.167.2:C:\Users\bob\Documents
if you need to send several files add -r
scp -r C:\Users\username\source_directory username@192.168.167.2:C:\Users\username\destination_directory
this works also between windows and linux
scp C:\Users\username\path\to\file.csv username@192.168.167.2:/home/username/destination_directory