croc

Version

Build Status

GitHub Sponsors

This project’s future depends on community support. Become a sponsor today.

Become a sponsor today

About

croc is a tool that allows any two computers to simply and securely transfer files and folders. AFAIK, croc is the only CLI file-transfer tool that does all of the following:

Allows any two computers to transfer data (using a relay)

Provides end-to-end encryption (using PAKE)

Enables easy cross-platform transfers (Windows, Linux, Mac)

Allows multiple file transfers

Allows resuming transfers that are interrupted

No need for local server or port-forwarding

IPv6-first with IPv4 fallback

Can use a proxy, like Tor

For more information about croc, see my blog post or read a recent interview I did.

my blog post

recent interview I did

Example

Install

You can download the latest release for your system, or install a release from the command-line:

the latest release for your system

On macOS

Using Homebrew:

Homebrew

Using MacPorts:

MacPorts

On Windows

You can install the latest release with Scoop, Chocolatey, or Winget:

Scoop

Chocolatey

Winget

Using nix-env

You can install the latest release with Nix:

Nix

On NixOS

You can add this to your configuration.nix:

configuration.nix

On Alpine Linux

First, install dependencies:

On Arch Linux

Install with pacman:

On Fedora

Install with dnf:

On Gentoo

Install with portage:

On Termux

Install with pkg:

On FreeBSD

Install with pkg:

On Linux, macOS, and Windows via Conda

You can install from conda-forge globally with pixi:

conda-forge

pixi

Or install into a particular environment with conda:

conda

On Linux, macOS via Docker

Add the following one-liner function to your ~/.profile (works with any POSIX-compliant shell):

You can also just paste it in the terminal for current session. On first run Docker will pull the image. croc via Docker will only work within the current directory and its subdirectories.

Build from Source

If you prefer, you can install Go and build from source (requires Go 1.22+):

install Go

On Android

There is a 3rd-party F-Droid app available to download.

available to download

Usage

To send a file, simply do:

Then, to receive the file (or folder) on another computer, run:

The code phrase is used to establish password-authenticated key agreement (PAKE) which generates a secret key for the sender and recipient to use for end-to-end encryption.

PAKE

Customizations & Options

Using croc on Linux or macOS

On Linux and macOS, the sending and receiving process is slightly different to avoid leaking the secret via the process name. You will need to run croc with the secret as an environment variable. For example, to receive with the secret ***:

leaking the secret via the process name

For single-user systems, the default behavior can be permanently enabled by running:

Custom Code Phrase

You can send with your own code phrase (must be at least 6 characters):

Allow Overwriting Without Prompt

To automatically overwrite files without prompting, use the --overwrite flag:

Excluding Folders

To exclude folders from being sent, use the --exclude flag with comma-delimited exclusions:

Use Pipes - stdin and stdout

You can pipe to croc:

To receive the file to stdout, you can use:

Send Text

To send URLs or short text, use:

Send Multiple Files

You can send multiple files directly by listing the files and/or folders:

Show QR Code

To show QR code (for mobile devices), use:

Use a Proxy

You can send files via a proxy by adding --socks5:

Change Encryption Curve

To choose a different elliptic curve for encryption, use the --curve flag:

Change Hash Algorithm

For faster hashing, use the imohash algorithm:

Clipboard Options

By default, the code phrase is copied to your clipboard. To disable this:

To copy the full command with the secret as an environment variable (useful on Linux/macOS):

This copies the full command like CROC_SECRET="code-phrase" croc (including any relay/pass flags).

Quiet Mode

To suppress all output (useful for scripts and automation):

Self-host Relay

You can run your own relay:

By default, it uses TCP ports 9009-9013. You can customize the ports (e.g., croc relay --ports 1111,1112), but at least 2 ports are required.

To send files using your relay:

Self-host Relay with Docker

You can also run a relay with Docker:

To send files using your custom relay:

To use custom ports, set CROC_PORTS (comma-separated) or CROC_PORT (base port):

Acknowledgements

croc has evolved through many iterations, and I am thankful for the contributions! Special thanks to:

@warner for the idea

@warner

idea

@tscholl2 for the encryption gists

@tscholl2

encryption gists

@skorokithakis for proxying two connections

@skorokithakis

proxying two connections

And many more!