Transfer.sh - When you can not use SCP

Sometimes I find myself in a situation where I'd like to transfer some files to a remote server that is behind some, let's say, "complicated" networking.


Such a condition prohibits the use of some rock-solid SCP. For this purpose, I found transfer.sh!
You can upload and download files via cURL! Even some basic restrictions (max. download count and max. age) are supported.

In the following example, I want to upload a ZIP file containing important ".sh" files. Because of that, they do not contain the passwords for the scripts to be useful.

⚠ Please consider all uploaded data to "transfer.sh" as publicly available, even if you restrict access to it ⚠

Upload a file, which gets removed after two days:

curl -H "Max-Days: 2" --upload-file ./update.zip https://transfer.sh/update.zip

This returns an URL for that uploaded file: https://transfer.sh/tCj82KIo/update.zip

Download and extract the ZIP file:

cd /tmp
curl https://transfer.sh/tCj82KIo/update.zip -o update.zip
unzip update.zip -d ./update/
cd update

All the "transfer.sh" magic is done now.
The next step replaces some passwords inside the shell scripts with sed.
In this case I want to use a regex condition to find the appropriate lines:

sed -i '/\$SRV1.\+sqlcmd/ s/SQLPASSWORD/aaaaaaa/' *.sh
sed -i '/\$SRV2.\+sqlcmd/ s/SQLPASSWORD/bbbbbbb/' *.sh
sed -i '/\$SRV3.\+sqlcmd/ s/SQLPASSWORD/ccccccc/' *.sh