transfer.sh - Easy and fast file sharing from the command-line.

Overview

transfer.sh Gitter Go Report Card Docker pulls Build Status

Easy and fast file sharing from the command-line. This code contains the server with everything you need to create your own instance.

Transfer.sh currently supports the s3 (Amazon S3), gdrive (Google Drive), storj (Storj) providers, and local file system (local).

Disclaimer

The service at transfersh.com is of unknown origin and reported as cloud malware.

Usage

Upload:

$ curl --upload-file ./hello.txt https://transfer.sh/hello.txt

Encrypt & upload:

$ cat /tmp/hello.txt|gpg -ac -o-|curl -X PUT --upload-file "-" https://transfer.sh/test.txt

Download & decrypt:

$ curl https://transfer.sh/1lDau/test.txt|gpg -o- > /tmp/hello.txt

Upload to virustotal:

$ curl -X PUT --upload-file nhgbhhj https://transfer.sh/test.txt/virustotal

Deleting

$ curl -X DELETE <X-Url-Delete Response Header URL>

Request Headers

Max-Downloads

$ curl --upload-file ./hello.txt https://transfer.sh/hello.txt -H "Max-Downloads: 1" # Limit the number of downloads

Max-Days

$ curl --upload-file ./hello.txt https://transfer.sh/hello.txt -H "Max-Days: 1" # Set the number of days before deletion

Response Headers

X-Url-Delete

The URL used to request the deletion of a file. Returned as a response header.

curl -sD - --upload-file ./hello https://transfer.sh/hello.txt | grep 'X-Url-Delete'
X-Url-Delete: https://transfer.sh/hello.txt/BAYh0/hello.txt/PDw0NHPcqU

Examples

See good usage examples on examples.md

Link aliases

Create direct download link:

https://transfer.sh/1lDau/test.txt --> https://transfer.sh/get/1lDau/test.txt

Inline file:

https://transfer.sh/1lDau/test.txt --> https://transfer.sh/inline/1lDau/test.txt

Usage

Parameter Description Value Env
listener port to use for http (:80) LISTENER
profile-listener port to use for profiler (:6060) PROFILE_LISTENER
force-https redirect to https false FORCE_HTTPS
tls-listener port to use for https (:443) TLS_LISTENER
tls-listener-only flag to enable tls listener only TLS_LISTENER_ONLY
tls-cert-file path to tls certificate TLS_CERT_FILE
tls-private-key path to tls private key TLS_PRIVATE_KEY
http-auth-user user for basic http auth on upload HTTP_AUTH_USER
http-auth-pass pass for basic http auth on upload HTTP_AUTH_PASS
ip-whitelist comma separated list of ips allowed to connect to the service IP_WHITELIST
ip-blacklist comma separated list of ips not allowed to connect to the service IP_BLACKLIST
temp-path path to temp folder system temp TEMP_PATH
web-path path to static web files (for development or custom front end) WEB_PATH
proxy-path path prefix when service is run behind a proxy PROXY_PATH
proxy-port port of the proxy when the service is run behind a proxy PROXY_PORT
ga-key google analytics key for the front end GA_KEY
provider which storage provider to use (s3, storj, gdrive or local)
uservoice-key user voice key for the front end USERVOICE_KEY
aws-access-key aws access key AWS_ACCESS_KEY
aws-secret-key aws access key AWS_SECRET_KEY
bucket aws bucket BUCKET
s3-endpoint Custom S3 endpoint. S3_ENDPOINT
s3-region region of the s3 bucket eu-west-1 S3_REGION
s3-no-multipart disables s3 multipart upload false S3_NO_MULTIPART
s3-path-style Forces path style URLs, required for Minio. false S3_PATH_STYLE
storj-access Access for the project STORJ_ACCESS
storj-bucket Bucket to use within the project STORJ_BUCKET
basedir path storage for local/gdrive provider BASEDIR
gdrive-client-json-filepath path to oauth client json config for gdrive provider GDRIVE_CLIENT_JSON_FILEPATH
gdrive-local-config-path path to store local transfer.sh config cache for gdrive provider GDRIVE_LOCAL_CONFIG_PATH
gdrive-chunk-size chunk size for gdrive upload in megabytes, must be lower than available memory (8 MB) GDRIVE_CHUNK_SIZE
lets-encrypt-hosts hosts to use for lets encrypt certificates (comma seperated) HOSTS
log path to log file LOG
cors-domains comma separated list of domains for CORS, setting it enable CORS CORS_DOMAINS
clamav-host host for clamav feature CLAMAV_HOST
rate-limit request per minute RATE_LIMIT
max-upload-size max upload size in kilobytes MAX_UPLOAD_SIZE
purge-days number of days after the uploads are purged automatically PURGE_DAYS
purge-interval interval in hours to run the automatic purge for (not applicable to S3 and Storj) PURGE_INTERVAL
random-token-length length of the random token for the upload path (double the size for delete path) 6 RANDOM_TOKEN_LENGTH

If you want to use TLS using lets encrypt certificates, set lets-encrypt-hosts to your domain, set tls-listener to :443 and enable force-https.

If you want to use TLS using your own certificates, set tls-listener to :443, force-https, tls-cert-file and tls-private-key.

Development

Switched to GO111MODULE

go run main.go --provider=local --listener :8080 --temp-path=/tmp/ --basedir=/tmp/

Build

$ git clone [email protected]:dutchcoders/transfer.sh.git
$ cd transfer.sh
$ go build -o transfersh main.go

Docker

For easy deployment, we've created a Docker container.

docker run --publish 8080:8080 dutchcoders/transfer.sh:latest --provider local --basedir /tmp/

S3 Usage

For the usage with a AWS S3 Bucket, you just need to specify the following options:

  • provider
  • aws-access-key
  • aws-secret-key
  • bucket
  • s3-region

If you specify the s3-region, you don't need to set the endpoint URL since the correct endpoint will used automatically.

Custom S3 providers

To use a custom non-AWS S3 provider, you need to specify the endpoint as defined from your cloud provider.

Storj Network Provider

To use the Storj Network as storage provider you need to specify the following flags:

  • provider --provider storj
  • storj-access (either via flag or environment variable STORJ_ACCESS)
  • storj-bucket (either via flag or environment variable STORJ_BUCKET)

Creating Bucket and Scope

In preparation you need to create an access grant (or copy it from the uplink configuration) and a bucket.

To get started, login to your account and go to the Access Grant Menu and start the Wizard on the upper right.

Enter your access grant name of choice, hit Next and restrict it as necessary/preferred. Aftwards continue either in CLI or within the Browser. You'll be asked for a Passphrase used as Encryption Key. Make sure to save it in a safe place, without it you will lose the ability to decrypt your files!

Afterwards you can copy the access grant and then start the startup of the transfer.sh endpoint. For enhanced security its recommended to provide both the access grant and the bucket name as ENV Variables.

Example:

export STORJ_BUCKET=
export STORJ_ACCESS=
transfer.sh --provider storj

Google Drive Usage

For the usage with Google drive, you need to specify the following options:

  • provider
  • gdrive-client-json-filepath
  • gdrive-local-config-path
  • basedir

Creating Gdrive Client Json

You need to create a Oauth Client id from console.cloud.google.com download the file and place into a safe directory

Usage example

go run main.go --provider gdrive --basedir /tmp/ --gdrive-client-json-filepath /[credential_dir] --gdrive-local-config-path [directory_to_save_config]

Contributions

Contributions are welcome.

Creators

Remco Verhoef

Uvis Grinfelds

Maintainer

Andrea Spacca

Stefan Benten

Copyright and license

Code and documentation copyright 2011-2018 Remco Verhoef. Code and documentation copyright 2018-2020 Andrea Spacca. Code and documentation copyright 2020- Andrea Spacca and Stefan Benten.

Code released under the MIT license.

Issues
  • Implement Native Storj Storage Adapter

    Implement Native Storj Storage Adapter

    With this PR transfer.sh has native bindings to the Storj network. Previously it was using the S3 backend and proxying the data through a S3 Gateway ( https://github.com/storj/storj/cmd/gateway/ ).

    @aspacca If needed, i can grant access to the Beta Network to try it out. I would appreciate a throughout test!

    opened by stefanbenten 27
  • curl: (92) HTTP/2 stream 0 was not closed cleanly: INTERNAL_ERROR (err 2)

    curl: (92) HTTP/2 stream 0 was not closed cleanly: INTERNAL_ERROR (err 2)

    doing this curl --upload-file quiet_01.txt https://transfer.sh and it returns curl: (92) HTTP/2 stream 0 was not closed cleanly: INTERNAL_ERROR (err 2)

    opened by OfekShochat 22
  • 502 error - Authentication popup never shown in browser

    502 error - Authentication popup never shown in browser

    I have a private transfer.sh instance running with authentication switched on. The setup is as follows:

    1. transfer.sh running on http://localhost:4000 on Centos 7
    2. Exposed to the internet via nginx with http redirect to https
    3. X-Forwarded-Proto is set so that transfer.sh displays all urls as https

    Issue:

    1. When I upload small files of a few KB the browser pop up for auth appears and accepts the user id and password.
    2. When I upload larger files (of a few MB) that take a few seconds to upload, the authentication popup never appears and after a few seconds after reaching 100% a (502) error is displayed like this: Error (502) during upload of file .....
    3. In the transfer.sh server log a 401 error is recorded
    4. The workaround is to first upload a small file, authenticate and then upload the large file and it then works.

    Any ideas if this is a config/landscape fix or needs a code change?

    opened by srinisubramanian 21
  • [Server Issue] Transfer.sh once again uploads nothing

    [Server Issue] Transfer.sh once again uploads nothing

    I can't upload anything on your server, it makes the speed very slow(sometimes directly 0) image

    I also requested IP change from my host and new IP also having same issue. This is 4th time in this week(I upload once every day). I also know what you guys want from me so there you go: image

    opened by EMREOYUN 19
  • Run app with non-root user

    Run app with non-root user

    Running applications in Docker as root user opens various attack vectors, as Docker's "isolation" isn't meant to be the only safe guard against adversaries. It should be considered a "last resort". It's best practice to use a non-root user wherever possible.

    This commit changes back to Alpine as a base, as it provides the adduser tool via busybox. It increases the image size by a few MiB (2-3, currently). One could optimize the image size by writing a custom /etc/passwd, but this seems quite unnecessary, especially given that Alpine is the base of so many other images.

    Fixes #100.

    opened by TheAssassin 19
  • Accounts

    Accounts

    I have read #22. What about allowing creating accounts, and if a file is uploaded in an account, then permit raw access? If GitHub account should be used for transfer.sh account creation, unethical use of the service could be lowered.

    opened by notramo 19
  • Fix s3 100MB max upload issue.

    Fix s3 100MB max upload issue.

    By setting u.MaxUploadParts = concurrency and u.PartSize = (1 << 20) * 5, there was a 100MB limit on S3 uploads. This PR removes that limit leaving MaxUploadParts at the default of 10,000 and allowing the option to set the part size for S3 uploads with s3-part-size.

    opened by n8225 18
  • Transfer.sh Deletion via browser returns 405 error, reconsider implementation for Delete via Get request?

    Transfer.sh Deletion via browser returns 405 error, reconsider implementation for Delete via Get request?

    Hi @stefanbenten ! I read through implementation discussion here: https://github.com/dutchcoders/transfer.sh/issues/44#issuecomment-399234697. So I understand it is not an issue with the code. It is the the website transfer.sh that should provide a delete form to process the delete GET-request, correct? So my wish would be that such a page would be set up for transfer.sh so that deletes can be successfully performed..

    I'd also appreciate a reconsideration of that discussion. In my view a direct delete by a GET request (without DELETE header) should be made possible without the need for an additional form or button. To prevent accidental or malicious deletes via crawler the delete link should be constructed more randomly with longer passwords and should be different from the download links and not derived from them. I believe atm they are too similar and can be easily computed if the download link is known.

    Originally posted by @beriner in https://github.com/dutchcoders/transfer.sh/issues/351#issuecomment-783746108

    enhancement question 
    opened by beriner 16
  • Fuzz Local Storage

    Fuzz Local Storage

    @bookmoons this is a skeleton of what I think should look like the fuzz test please review, and if it's ok I will properly randomize token and filename and all the rest

    alternatively instead of testing directly the storage we can build the http request to the listener that will hit the equivalent method in the storage that I tested now: what would be the best solution?

    btw: I didn't run the code yet

    opened by aspacca 15
  • Example Zsh/Bash function for transfer.sh homepage

    Example Zsh/Bash function for transfer.sh homepage

    Hello,

    I just want to share this. If you consider my function as an worthy example for the homepage, go for it!:

    transfer()
    {
        local file="${1}"
        local filename="${file##*/}"
        # show delete link from the response header after upload. the command "sed" is necessary to clean up the output, "gsub()" in "awk" does not work.
        curl --request PUT --progress-bar --dump-header - --upload-file "${file}" "https://transfer.sh/${filename}" | sed "s/#//g" | awk '/x-url-delete/ { print "Delete command: curl --request DELETE " $2 } END{ print "Download link: " $1 }'
    }
    

    Example outputs:

    $ transfer image.img
    ######################################################################################################################################################################################################################################## 100.0%
    Delete command: curl --request DELETE https://transfer.sh/Ge9cuW/image.img/<some_delete_token>
    Download link: https://transfer.sh/Ge9cuW/image.img
    
    $ transfer /tmp/tmp.LkwBEu5r64/image2.img
    ######################################################################################################################################################################################################################################## 100.0%
    Delete command: curl --request DELETE https://transfer.sh/oeopqy/image2.img/<some_delete_token>
    Download link: https://transfer.sh/oeopqy/image2.img
    

    -Ramon

    opened by keks24 13
  • transfer.sh Down?

    transfer.sh Down?

    Hi there! Thanks for making and hosting such a useful service!

    It looks like there's some issue with the backend right now?

    $ curl -v https://transfer.sh/
    *   Trying 54.77.221.1...
    * Connected to transfer.sh (54.77.221.1) port 443 (#0)
    * TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
    * Server certificate: transfer.sh
    * Server certificate: COMODO RSA Domain Validation Secure Server CA
    * Server certificate: COMODO RSA Certification Authority
    * Server certificate: AddTrust External CA Root
    > GET / HTTP/1.1
    > Host: transfer.sh
    > User-Agent: curl/7.43.0
    > Accept: */*
    >
    < HTTP/1.1 503 Service Unavailable: Back-end server is at capacity
    < Content-Length: 0
    < Connection: keep-alive
    <
    * Connection #0 to host transfer.sh left intact
    
    opened by songgao 13
  • Add an option to password protect a file

    Add an option to password protect a file

    I think it would be awesome if we could restrict unknown users from even downloading a file (not just encryption). I think the easiest way is that if the uploader wants, he can set a password, and if the downloader wants to have that file, he should enter that password.

    opened by CodeCubeNeo 0
  • How can I resume downloads?

    How can I resume downloads?

    I'm downloading from transfer.sh url like wget -c "https://transfer.sh/..." but in the middle way an error occurs stating that "...バイトで読み込みエラーが発生しました (Operation timed out)。 再試行しています。". Then it restarts downloading but from the scratch (progress bar starts from 0%). I read this https://github.com/dutchcoders/transfer.sh/issues/289 but didn't get the solution.

    opened by niss88 15
  • Guide for deploying on Synology?

    Guide for deploying on Synology?

    Sorry for the noob question - but I wonder devs might lend me a hand on deploying transfer.sh onto my synology NAS via docker, please? Many thanks! :))

    opened by kzssc 3
  • Fix for unrecognized flags on du

    Fix for unrecognized flags on du

    --total --block-size="K" --dereference were all unrecognized flags for this script. I have updated them to the correct flags to run correctly.

    opened by frankievalentine 0
Releases(v1.4.0)
Owner
Dutchcoders
Coding for fun. http://twitter.com/dutchcoders/
Dutchcoders
oDrop, a fast efficient cross-platform file transfer software for server and home environments

oDrop is a cross-platform LAN file transfer software to efficiently transfer files between computers, oDrop is useful in environments where GUI is not available.

Flew Software 16 Jun 4, 2022
Yet another netcat for fast file transfer

nyan Yet another netcat for fast file transfer When I need to transfer a file in safe environment (e.g. LAN / VMs), I just want to use a simple comman

null 6 Apr 30, 2022
pcp - 📦 Command line peer-to-peer data transfer tool based on libp2p.

pcp - Command line peer-to-peer data transfer tool based on libp2p.

Dennis Trautwein 880 Aug 9, 2022
Distributed File Store Application Consist of API Server to handle file operations and command line tool to do operations

Filestore Distributed File Store Application Consist of API Server to handle file operations and command line tool to do operations (store named binar

null 0 Nov 7, 2021
aqua is a simple file uploading and sharing server for personal use.

aqua is a simple file uploading and sharing server for personal use. It is built to be easy to set up and host on your own server, for example to use it in combination with uploading tools like ShareX.

Tobias B. 14 Jul 7, 2022
A web based drag and drop file transfer tool for sending files across the internet.

DnD A file transfer tool. Demo Usage Get go get github.com/0xcaff/dnd or download the latest release (you don't need go to run it) Run dnd Now navig

Martin Charles 18 Feb 18, 2022
Simple temporary file upload and transfer web application coding with Go language.

Temp File Transfer Web Application Simple temporary file upload and transfer web application coding with Go language. Explore the Golang » Live Demo T

Alper Reha 0 Mar 5, 2022
Delta : File Sharing system for golang

delta is File Sharing system its good for Local networks or small teams Cross-platform delta runs anywhere Go can compile for: Windows, Mac, Linux, AR

null 0 Nov 29, 2021
Subspace - File sharing application for golang

subspace File sharing application. Supported Platforms OS 386 amd64 arm6 arm64 L

Jim Male 1 Jan 29, 2022
peer-to-peer file sharing

what i want is a tool to use to send files my many virtual machines. I want to do this myself, and i want to make it work as expected. So maybe a daem

Joseph Attah 0 Jun 13, 2022
wholeaked is a file-sharing tool that allows you to find the responsible person in case of a leakage

wholeaked is a file-sharing tool that allows you to find the responsible person in case of a leakage

Utku Sen 669 Aug 3, 2022
Built in user interface, LAN file transfer, such as mobile phone, computer, tablet, different operating system

Modao Built in user interface, LAN file transfer, such as mobile phone, computer, tablet, different operating systems, etc., as well as text transfer

null 0 May 7, 2022
FileTransferGo - File Transfer With Golang

FileTransferGo Packages used ?? Go: Gin (http server) ?? Cobra (CLI command fram

PiterDev 3 Jun 24, 2022
mini file transfer tool, use it just curl o wget

miniTransfer mini file transfer tool, use it just curl o wget How to use upload file curl -T localFileName 127.0.0.1:1234 # default save as localFileN

chenlianghong 0 Jan 12, 2022
An experimental project to build a framework for naming and sharing files and other data securely

Upspin Documentation: upspin.io About the project Upspin is an experimental project to build a framework for naming and sharing files and other data s

Rohan 0 Oct 20, 2021
Transfer - A simple go application for uploading, downloading and checksumming of files

Transfer This project holds a simple go application for uploading, downloading a

Florian Bauer 1 Jun 21, 2022
🖥 Securely transfer and send anything between computers with TUI.

??️ Securely transfer and send anything between computers with TUI. Installation ways

Abdfn 142 Aug 8, 2022
Transfer your local .ENV files for another developer

Zip/Unzip local .env file Transfer your local .ENV files for another developer. for Zip: run in root where .env files ./ziper_local_env created "resu

Фарид 1 Oct 20, 2021
Personal tool used for transfer files between servers.

transfer Personal tool used for transfer files between servers. Usage: transfer [global options] <verb> [verb options] Global options: -h, --

BugWriter 0 Jan 5, 2022