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

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.

Owner
Dutchcoders
Coding for fun. http://twitter.com/dutchcoders/
Dutchcoders
Comments
  • 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!

  • 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)

  • 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?

  • [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

  • 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.

  • 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.

  • 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.

  • 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

  • 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

  • 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

  • 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
    
  • Getting error 'not found' for every uploaded file

    Getting error 'not found' for every uploaded file

    I have setup storj as provider. I can successfully upload the file, (I can verify the uploaded file in the storj bucket) but when I open the output url it giving me error 'Not found'. Log

     [transfer.sh]2022/12/28 06:16:09 Error metadata: EOF
     [transfer.sh]2022/12/28 06:16:08 Getting file 62bc21edb1deb.mp4.metadata from Storj Bucket
    [transfer.sh]2022/12/28 06:16:04 47.31.141.30:0 - - [2022-12-28T06:16:04Z] "PUT /62bc21edb1deb.mp4 HTTP/1.1" 200  "https://*******.sh/"; "Mozilla/5.0 (Android 11; Mobile; rv:108.0) Gecko/108.0 Firefox/108.0"
     [transfer.sh]2022/12/28 06:15:51 Uploading file 62bc21edb1deb.mp4 to Storj Bucket
     [transfer.sh]2022/12/28 06:15:51 Uploading Bdm5IY 62bc21edb1deb.mp4 11009799 
     [transfer.sh]2022/12/28 06:15:51 Uploading file 62bc21edb1deb.mp4.metadata to Storj Bucket
    
  • delete url should respect http basic auth

    delete url should respect http basic auth

    I am using docker with local provider and activated http basic auth. But as long as you know the delete url, you can delete the file immediately without providing username and password, is it intended?

  • Error 413

    Error 413

    I did a search and found it might be a size limit issue, then I looked at the README, which is extremely confusing.

    How should I pass those "parameters" to transfer.sh or its docker container? According to "usage" table it looks like I should use environment variables but passing MAX_UPLOAD_SIZE didn't work.

  • Zsh/Bash function: Be compatible with BSD's, macOS' and Linux' `du` command and add more examples

    Zsh/Bash function: Be compatible with BSD's, macOS' and Linux' `du` command and add more examples

    Relates to #475, #478 and #483.

    This improves the function transfer() to be able to upload files with spaces in their filenames.

    Every space character is replaced with the URL encoding character: %20.

    I also added some more examples.

    $ transfer --help
    [...]
    
    EXAMPLES:
    [...]
      Upload multiple files with spaces in their filename from the current working directory:
          transfer "image 1.img" image\ 2.img
    [...]
      Upload multiple files from a different directory:
          transfer transfer /tmp/{image1.img,image\ 1.img,"image 2.img"}
    [...]
    
    $ transfer "image 1.img" image\ 2.img
    4K      image 1.img
    4K      image 2.img
    8K      total
    Do you really want to upload the above files (2) to "transfer.sh"? (Y/n):
    ######################################################################################################################################################################################################################################## 100.0%
    Delete command: curl --request DELETE "https://transfer.sh/V4X6y0/image%201.img/gBjLz3jMRxd4"
    Delete token: gBjLz3jMRxd4
    Download link: https://transfer.sh/V4X6y0/image%201.img
    
    ######################################################################################################################################################################################################################################## 100.0%
    Delete command: curl --request DELETE "https://transfer.sh/CHLy0j/image%202.img/hPd1EfqSbCk7"
    Delete token: hPd1EfqSbCk7
    Download link: https://transfer.sh/CHLy0j/image%202.img
    

    image 1.img | image 2.img :----------------: | :-----------------: image_1 | image_2

  • Update version of go to >=1.18?

    Update version of go to >=1.18?

    For personal use, I currently working on adding support for Azure blob storage as an alternative storage driver (https://github.com/joshspicer/transfer.sh/blob/main/server/storage/azure.go).

    I would love to contribute back the Azure storage driver back to this repo. The Azure SDKs require at least go 1.18. I am curious if there's any justification for pinning this project to go 1.15, which is now unsupported.

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.

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

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.

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

Jan 5, 2023
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

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.

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.

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

Dec 16, 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

Dec 2, 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

Nov 29, 2021
Subspace - File sharing application for golang

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

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

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

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

Dec 25, 2022
Built in user interface, LAN file transfer, such as mobile phone, computer, tablet, different operating system
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

May 7, 2022
FileTransferGo - File Transfer With Golang

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

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

Jan 12, 2022
An experimental project to build a framework for naming and sharing files and other data securely
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

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

Aug 18, 2022
๐Ÿ–ฅ Securely transfer and send anything between computers with TUI.
๐Ÿ–ฅ Securely transfer and send anything between computers with TUI.

??๏ธ Securely transfer and send anything between computers with TUI. Installation ways

Dec 21, 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

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, --

Jan 5, 2022