Giter VIP home page Giter VIP logo

pscp's Introduction

Parallel Secure Copy (pscp)

Bash script utility for running secure copy of a file in chunks in parallel.

Installation

From your favorite terminal, run:

curl -s https://raw.githubusercontent.com/yinonavraham/pscp/master/bin/setup/install.sh | bash

Usage

pscp [OPTIONS] FILE DEST

Example

In order to copy a local file named myfile to path /path/to/ in a remote host named some-other-host, authenticating as myuser (based on SSH key), use:

pscp myfile myuser@some-other-host:/path/to/

Basic Options

  • --help
    Show usage help. Use this to inspect all options the utility supports.
  • --threads=<value> Specify the number of chunks to split the file to. These chunks are then sent in parallel.
  • --verbose
    Print verbose output of the actions done by the script.

Implementation

The script performs the following main operations:

  1. Create a temporary local transaction directory. This directory is used to save all temporary files created during the transfer.
  2. Split the source file to chunks (according to the threads value). These chunk files are saved in the local transaction directory.
  3. Create a temporary transaction directory in the remote host.
  4. Start background processes to transfer each chunk file (using scp). Each such process appends a line to a control file (saved in the local transaction directory).
  5. Wait for all background processes to finish. This is done by polling on the control file.
  6. Assemble the file in the remote host from all the chunk files.
  7. Verify the checksum of the source file and the remote file is the same.
  8. Cleanup the transaction directories (local and remote).

Maintenance

Update
To update pscp to its latest version, use:

pscp --setup=update

Uninstall
To remove pscp installation, use:

pscp --setup=uninstall

Statistics

This script started as an experiment. As part of the experiment files of various sizes were copied between AWS instances, from Frankfurt DE to Oregon US. The same files were copied 10 times using scp (i.e. single process) and 10 times using pscp with default threads (i.e. 10 parallel scp processes, each transfers a single chunk). The results, as can be seen below, transfer time in parallel (using pscp) is approximately 30%-40% of the time compared to using scp.

Average Transfer Time vs. Size

Average Transfer Rate vs. Size

Notes

There are several overheads which are not included in the calculations above:

  1. Splitting the file in the source and re-assembling it in the destination.
    This is a mandatory overhead, but it usually takes no more than 2-3 seconds.
  2. In order to verify that the file was transferred successfully, the script performs a checksum verification. It calculates the checksum (SHA-1) of the file in the source, the checksum of the file in the destination and compares them. This verification also takes ~2 seconds, but can be disabled using the --no-verify flag.
  3. The script cleans up temporary files (mainly the chunks and a control file) from both the source and the destination. This cleanup also takes ~2 seconds, but can be disabled using the --no-cleanup flag.

Contributing

Contributions of all kinds are more than welcome (bug fixes, new features, documentation, etc.).
Feel free to create an issue, or even better - open a pull request.

pscp's People

Contributors

eldada avatar yinonavraham avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

eldada dhomane

pscp's Issues

Special char é in path not accepted by pscp.exe

Hello, I'm using special char é in the path in the argument of pscp, but there is an encoding issue within pscp 0.76

pscp.exe -sshlog "C:\Users\admin_bdv\Documents\scripts\DMZ deployment\log\ssh_20220512161141.log" -logappend -hostkey SHA256:JBH8345udrLCuOknwr/Pl2vh+4zw9z/0wZAOgLXnoV4 "C:\publiciteit\openings_v175.jpg" [email protected]:"D:\shares\applic\online.vdk.be\préproductie\online_net\publiciteit"
[email protected]'s password:
pscp: unable to open D:\shares\applic\online.vdk.be\prÚproductie\online_net\publiciteit: no such file or directory

How could I resolve this issue?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.