In ssh protocol, is there a mechanism for file transfer?
Im working on a existing code base which already has ssh facilities code. Now i need to transfer files over ssh connection. If ssh protocol already support it, i don't have to integrate scp stuff into it.
Thanks.
Edit:
Im using C, ssh code based on openssh.
I have to transfer the file programmingly, not using a external program/command because of some constraints. The program supposed to transfer any size file on remote host chunk-by-chunk, and process the chunk on-the-fly. Then the chunk data is discarded.
A client can use an SCP to upload files to a remote server safely, download files, or even transfer files via SSH across remote servers.
Often you will need to move one or more files/folders or copy them to a different location. You can do so using an SSH connection. The commands which you would need to use are mv (short from move) and cp (short from copy). By executing the above command you will move (rename) the file original_file to new_name.
The scp command uses SSH to transfer data, so it requires a password or passphrase for authentication. Unlike rcp or FTP, scp encrypts both the file and any passwords exchanged so that anyone snooping on the network cannot view them.
echo "hello" | ssh user@SSHHost "cat - > /tmp/file"
I juste read the file, pipe it in SSH, and write on the SSHHost server in the /tmp/file.
sftp and scp are both existing "secure" file transfer methods, but your answers are going to depend on what technology stack you are using for your application. You don't mention whether you're using C#, PHP or another language, or what kind of machine your app runs on. These things will have a big bearing on the answers you will get.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With