This creates a new key, using your email as the label, with the RSA encryption algorithm
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
-t tells us what type to create, in our case, we will use rsa protocol version 2, it is a key that will work everywhere. -b is the number of bits
Next, you will be prompted to enter a file to save the key. For most purposes, the .ssh/ folder under the home folder is the default and will suffice.
Finally, you will be asked to enter a passphrase. Press enter to skip this process and continue without a pass phrase
Please download PuTTYgen.
- Open the PuTTYgen program.
- Select "SSH-2 RSA" for "Type of key to generate".
- Click the "Generate" button.
- Move the mouse below the progress bar until it is full.
- Type a passphrase (optional).
- Click the "Save private key" button.
- Copy down the public key to be shared.
Included in this repository is a bash script named "upload_data.sh", and within it, is a detailed description of the command that is to be used to upload CSV files.
Steps to use this script:
- Ensure that it is executable with this command:
chmod +x upload_data.sh
- Run it by passing the parameters of servername, username .CSV filename
- Example:
./upload_data.sh -s sftp.exampleserver.com -u the-user -f /home/the-user/data.csv
- If anything is unclear, feel free to get the help info
by:
./upload_data.sh -h
or./upload_data.sh --help
-OR-
Included is a python version for this. This is a lengthier
tutorial and requires you have python-virtualenv
installed
on your machine.
- Install
python-virtualenv
by:sudo apt-get install python-virtualenv
- Make a virtualenv:
virtualenv venv
- Activate the virtualenv:
source venv/bin/activate
- Install the requirements for this python script:
pip install -r requirements.txt
The requirements.txt is located in the 'python-upload' folder of this project - Run the upload_data.py script: python upload_data.py
- If I had a server named "sftp.example.com" and my user is
"superman", with a .CSV located at:
/home/superman/data.csv and a private key located in:
/home/superman/.ssh/id_rsa then I would run it as:
python upload_data.py sftp.example.com superman /home/superman/data.csv/ /home/superman/.ssh/id_rsa
- It is advisable to pass in absolutely paths.
If you experience any unexpected behaviors, please file an issue with the command you entered to trigger that behavior and the error output.