croc
Easily and securely send files or folders from one computer to another
About croc
This large README is shown as a plain-text preview. Read the full README at the source
<p align="center">
<a href="https://getcroc.com"><img src="web/src/assets/croc.jpg" width="408px" border="0" alt="croc"></a>
<br>
<a href="https://github.com/schollz/croc/releases/latest"><img src="https://img.shields.io/github/v/release/schollz/croc" alt="Version"></a>
<a href="https://github.com/schollz/croc/actions/workflows/ci.yml"><img src="https://github.com/schollz/croc/actions/workflows/ci.yml/badge.svg" alt="Build Status"></a>
<a href="https://github.com/sponsors/schollz"><img alt="GitHub Sponsors" src="https://img.shields.io/github/sponsors/schollz"></a>
</p>
<p align="center">
<strong>This project’s future depends on community support. <a href="https://github.com/sponsors/schollz">Become a sponsor today</a>.</strong>
</p>
## 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 (p2p with relay fallback)
- Provides **end-to-end encryption** (using PAKE)
- Enables easy **cross-platform** transfers (Windows, Linux, Mac, [Browser](https://getcroc.com))
- 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](https://schollz.com/tinker/croc6/) or read a [recent interview I did](https://console.substack.com/p/console-91).

## No-install
You can use croc without installing anything at [getcroc.com](https://getcroc.com).
The browser version is fully compatible with the CLI, so you can send and receive files between them.
## Install
You can download [the latest release for your system](https://github.com/schollz/croc/releases/latest), or install a release from the command-line:
```bash
curl https://getcroc.com | bash
```
The installer places **croc** and **croc-update** in the same directory. Standalone
release archives include both binaries too. To upgrade:
```bash
croc update # check croc and prepare the updater when needed
croc-update # update the croc active on PATH
```
The updater shows download progress with transferred bytes. Each command asks
before changing a binary. Pass `--yes` to each command to skip
its confirmation. Protected directories such as `/usr/local/bin` may still
require authentication: the command requests `sudo` or `doas` on Unix, or UAC
approval on Windows. Writable custom prefixes work without elevation:
```bash
curl https://getcroc.com | bash -s -- -p "$HOME/.local/bin"
```
`croc update --check` reports croc release availability without installing;
`croc-update --check` checks the croc active on `PATH`. Direct helper use selects
that executable first, including a user-owned installation such as
`$HOME/go/bin/croc`. If croc is absent from `PATH`, it installs beside the helper.
Use `croc-update --path /path/to/croc` to select a particular installation.
When croc is current, `croc update` prints only its up-to-date message. When a
new release is available, it ensures the helper is ready and prints
`Run: croc-update`. `croc upgrade` is an alias for `croc update`. Neither binary
overwrites itself or automatically downgrades a newer installed version.
If an older `croc update` reports that the running executable is not writable,
run the installer once to obtain this pair. Subsequent upgrades use the commands
above. Manually extracted standalone archives do not need installer registration.
Package-managed installations use their owning package manager instead.
When the CLI sends or receives a transfer, it checks for a newer croc release at
most once every 24 hours. The check runs in the background and any update notice
is shown after the transfer finishes. Network and release-service failures in
background checks are ignored; `--quiet` suppresses the notice. Set
`CROC_DO_CHECK=0` or `CROC_NO_UPDATE_CHECK=1` (`CROC_NO_UPDATE_CHECK` takes `1`, `0`,
`true` or `false`), or run `croc --no-update-check send [filename]`, to skip the
check. To keep skipping it, export `CROC_NO_UPDATE_CHECK=1`, or add `--remember` to a
regular send or receive that uses `--no-update-check`. `--remember` saves all of that
run's settings, including a receive code, and replaces earlier ones. Each side
remembers them separately.
### On macOS
Using [Homebrew](https://brew.sh/):
```bash
brew install croc
```
Using [MacPorts](https://www.macports.org/):
```bash
sudo port selfupdate
sudo port install croc
```
### On Windows
You can install the latest release with [Scoop](https://scoop.sh/) or
[Chocolatey](https://chocolatey.org/):
```bash
scoop install croc
```
```bash
choco install croc
```
### On Debian and Ubuntu
The [pkg.haus archive](https://pkg.haus/) provides third-party Debian packages.
Follow its repository setup and supported-release instructions before running:
```bash
sudo apt install croc
```
For a release that includes upstream `.deb` downloads, download the file matching
`dpkg --print-architecture` from the [release page](https://github.com/schollz/croc/releases).
Replace `VERSION` and `ARCH` below with the downloaded filename:
```bash
sudo apt install ./croc_VERSION-1_ARCH.deb
```
This downloaded-package method also applies to older Debian and Ubuntu releases
that do not provide croc in their configured repositories. It does not add an APT
repository; download a newer package to upgrade it.
### On Fedora and openSUSE
For a release that includes upstream `.rpm` downloads, choose the file matching
`rpm --eval '%{_arch}'` from the [release page](https://github.com/schollz/croc/releases).
Replace `VERSION` and `ARCH` with the downloaded filename:
```bash
sudo dnf install ./croc-VERSION-1.ARCH.rpm
# On openSUSE:
sudo zypper install ./croc-VERSION-1.ARCH.rpm
```
These downloads install the CLI, manual, license notices, and shell completions.
They require `ca-certificates` and start no background services. Upgrade them
through the package manager; `croc update` leaves package-owned binaries intact.
See [Linux packaging](packaging/README.md) for architectures and verification.
### On Arch Linux
Install with `pacman`:
```bash
pacman -S croc
```
### On Termux
Install with `pkg`:
```bash
pkg install croc
```
### On Linux, macOS, and Windows via Conda
You can install from [conda-forge](https://github.com/conda-forge/croc-feedstock) globally with [`pixi`](https://pixi.sh/):
```bash
pixi global install croc
```
Or install into a particular environment with [`conda`](https://docs.conda.io/projects/conda/):
```bash
conda install --channel conda-forge croc
```
### On Linux, macOS via Docker
Add the following one-liner function to your ~/.profile (works with any POSIX-compliant shell):
```bash
croc() { [ $# -eq 0 ] && set -- ""; mkdir -p "$HOME/.config/croc"; docker run --rm -it --user "$(id -u):$(id -g)" -v "$(pwd):/c" -v "$HOME/.config/croc:/.config/croc" -w /c -e CROC_SECRET docker.io/schollz/croc "$@"; }
```
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](https://go.dev/dl/) and build from source (requires Go 1.27.3+):
```bash
go install github.com/schollz/croc/v11@latest
```
### On Desktop
Community made desktop apps:
- [CrocApp](https://github.com/bakirgdev/CrocApp) — unofficial native SwiftUI app for Mac, iPhone and iPad ([App Store](https://apps.apple.com/app/crocapp/id6805675003)); embeds croc in-process for send/receive, QR codes, the share sheet and relay hosting.
## Usage
To send a file, simply do:
```bash
$ croc send [file(s)-or-folder]
Sending 'file-or-folder' (X MB)
Code is: code-phrase
```
Then, to receive the file (or folder) on another computer, run:
```bash
croc code-phrase
```
Folder transfers include Git repository metadata (`.git`) without an extra flag,
using the normal acceptance and overwrite handling. Paths containing `.ssh` or
`.gnupg` components are still rejected, including case variants.
The code phrase is used to establish password-authenticated key agreement ([PAKE](https://en.wikipedia.org/wiki/Password-authenticated_key_agreement)) which generates a secret key for the sender and recipient to use for end-to-end encryption.
### Share a terminal with `croc ssh`
On Linux, macOS, FreeBSD, or OpenBSD, start a shared terminal with:
```bash
croc ssh
```
The host receives separate six-word invitations for read/write and read-only
participants. On Unix, a participant keeps the invitation out of the process
list by joining with the command croc prints:
```bash
CROC_SECRET='six-word-invitation' croc ssh
```
Everyone sees one persistent terminal. Multiple read/write participants may
type; read-only participants receive the same output but their input is
discarded.
This does not expose an SSH daemon or require an account, public IP, inbound
port, or SSH key setup. The invitation authenticates an ephemeral Tailcat
WireGuard path and pins an ephemeral SSH host key. Tailcat uses DERP when it
cannot establish a direct path; if Tailcat itself is unavailable, the client
reauthenticates and carries the pinned SSH stream over the ordinary croc relay.
Remote commands, forwarding, and SFTP are disabled. Anyone who receives an
invitation has the role printed beside it until the host stops, so treat both
invitations as secrets.
See the
[SSH sharing design and security guide](src/docs/SSH_SHARING.md) for protocol,
reconnection, platform, relay, and threat-model details.
### Customizations & Options
#### Encrypted temporary storage
When an immediate peer-to-peer transfer is inconvenient, `croc` can upload
regular files as client-side encrypted ciphertext:
```bash
croc store [file1] [file2]
croc store --downloads 3 --expiration 3d [file1] [file2]
croc store --url https://files.example.com [file1] [file2]
```
The original `croc send --store` syntax remains supported, with
`--store-downloads`, `--store-expiration`, and `--store-url` settings.
The command prints a browser link and a CLI token. The transfer expires after
the selected lifetime, measured from successful upload completion, or after
its configured number of receivers download, authenticate, and verify every
file—whichever happens first. The lifetime defaults to one day and accepts
whole minutes (`m`), hours (`h`), days (`d`), or weeks (`w`). The download
limit defaults to one. Both values are subject to server policy. Run `croc`
with no arguments and paste the token at the prompt to receive it. For
automation, keep the token out of the process list:
```bash
CROC_STORE_TOKEN='croc-store-v1....' croc --out ./downloads
```
The browser link has the form
`https://host/s/id#v1.decryption-key`. The decryption key is after `#` because
URL fragments are not included in HTTP requests, so the storage service gets
the opaque transfer ID but not the key. The full link is still a secret: anyone
who has it can decrypt the files and claim one of the allowed downloads.
While a transfer remains available, its sender can delete it with the locally
saved revoke receipt:
```bash
croc --revoke [transfer-id]
```
Stored mode is opt-in and separate from croc's normal live relay transfers. A
self-hosted service can be selected with `croc store --url` (or
`croc send --store --store-url`) or `CROC_STORE_URL`.
See [the stored-transfer design and operator guide](src/docs/STORED_TRANSFERS.md)
for protocol, privacy, limits, and deployment details.
#### 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](https://nvd.nist.gov/vuln/detail/CVE-2023-43621). You will need to run `croc` with the secret as an environment variable. For example, to receive with the secret `***`:
```bash
CROC_SECRET=*** croc
```
For single-user systems, the default behavior can be permanently enabled by running:
```bash
croc --classic
```
#### Custom Code Phrase
You can send with your own code phrase (must be at least 6 characters):
```bash
croc send --code [code-phrase] [file(s)-or-folder]
```
For default public transfers, SHA-256 of the exact code modulo the ordered
three-relay pool determines which deployment both peers use. An automatically
generated sender probes all three relays and generates a normal EFF code that
maps to the first healthy one to respond. A custom code maps directly without probing
or fallback. `--relay`, `CROC_RELAY`, `--ip`, and local-only transfers bypass
this public routing rule. The generated sender caches the winning address in
`best-relay` alongside croc's other configuration files, then reuses it without
probing. A relay connection failure removes the cache so the following send
measures the pool again; deleting the file also forces a new measurement.
#### Allow Overwriting Without Prompt
To automatically overwrite files without prompting, use the `--overwrite` flag:
```bash
croc --yes --overwrite <code>
```
#### Keep Both Files Without Prompt
To keep an existing file and receive the incoming one under a new name (e.g. `video (1).mkv`), use the `--rename` flag:
```bash
croc --yes --rename <code>
```
#### Excluding Folders
To exclude folders from being sent, use the `--exclude` flag with comma-delimited exclusions. This does a case-insensitive **substring** match against each file's relative path, so any path containing one of the given strings anywhere is excluded:
```bash
croc send --exclude "node_modules,.venv" [folder]
```
If you need to exclude one specific file rather than every path containing a substring (for example, two files share a name at different depths and only one should be excluded), use `--exclude-file` instead. It takes comma-delimited relative paths and matches them **exactly**:
```bash
croc send --exclude-file "subfolder/image.jpg" [folder]
```
#### Use Pipes - stdin and stdout
You can pipe to `croc`:
```bash
cat [filename] | croc send
```
To receive the file to `stdout`, you can use:
```bash
croc --yes [code-phrase] > out
```
#### Send Text
To send URLs or short text, use:
```bash
croc send --text "hello world"
```
#### Send Multiple Files
You can send multiple files directly by listing the files and/or folders:
```bash
croc send [file1] [file2] [file3] [folder1] [folder2]
```
#### Show QR Code
To show QR code (for mobile devices), use:
```bash
croc send --qr [file(s)-or-folder]
```
The QR code opens `https://getcroc.com/?code=...`, where the web client
automatically connects in receive-only mode. `croc send` prints that same
address as "Or open". `--web-url` or `CROC_WEB_URL` replaces `https://getcroc.com`
with the origin of a self-hosted croc-web site. This is not `CROC_STORE_URL`.
#### Use a Proxy
You can send files via a proxy by adding `--socks5`:
```bash
croc --socks5 "127.0.0.1:9050" send SOMEFILE
```
Relay hostnames are resolved by the proxy, so the client does not need a
working DNS server to reach the relay. Bare `host:port`, `socks5://host:port`,
and `socks5h://host:port` all use proxy-side relay DNS. Use an IP address for
the proxy itself when local DNS is unavailable. Set `--socks5` on both peers
(or use the `SOCKS5_PROXY` environment variable).
For a network that only permits proxy traffic, use `--transport relay` on the
sender to use the SOCKS5-capable relay transport for file data. The browser
client uses the browser's proxy settings for its WebSocket gateway connection;
the native CLI flag does not configure the browser.
### Data transport selection
The native CLI defaults to `--transport auto`. After the normal three-word-code
PAKE handshake, two compatible native clients create PAKE-bound Tailcat node
identities and open one or more TCP streams over an in-process Tailscale
userspace WireGuard network. Magicsock starts through DERP and promotes the
connection to a direct UDP path whenever NAT traversal succeeds. If the peer is
a browser, an older client, or Tailcat setup fails, both clients use croc's
existing relay data ports. The public spelling `--transport derp` is retained;
in strict mode it requires Tailcat support and disables croc-relay fallback.
Public DERP is best effort and may apply fairness limits; see Tailscale's
[DERP reference](https://tailscale.com/docs/reference/derp-servers) and
[performance guidance](https://tailscale.com/docs/reference/troubleshooting/poor-performance-tailnet).
#### Change Encryption Curve
To choose a different elliptic curve for encryption, use the `--curve` flag:
```bash
croc --curve p521 <codephrase>
```
#### Change Hash Algorithm
For faster hashing, use the `imohash` algorithm:
```bash
croc send --hash imohash SOMEFILE
```
#### Clipboard Options
By default, the code phrase is copied to your clipboard. To disable this:
```bash
croc --disable-clipboard send [filename]
```
To copy the full command with the secret as an environment variable (useful on Linux/macOS):
```bash
croc --extended-clipboard send [filename]
```
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):
```bash
croc --quiet send [filename]
```
#### Self-host Relay
You can run your own relay:
```bash
croc 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.
Each relay port allows 64 incomplete handshakes in total and 32 per source IP.
Clients must send their first complete protocol message within 60 seconds and
finish the handshake within 5 minutes. Croc sends the first message automatically;
these deadlines do not limit how long an authenticated sender can wait for a
receiver or how long a transfer can run. Existing room and connection timeouts
still apply.
Use `--max-pending-handshakes`, `--max-pending-handshakes-per-source`,
`--first-message-timeout`, and `--handshake-timeout` to adjust these limits.
Their environment variables are `CROC_MAX_PENDING_HANDSHAKES`,
`CROC_MAX_PENDING_HANDSHAKES_PER_SOURCE`, `CROC_FIRST_MESSAGE_TIMEOUT`, and
`CROC_HANDSHAKE_TIMEOUT`. All values must be positive; the total limit and overall
timeout always bound the per-source allowance and first-message timeout.
Users behind the same NAT or proxy share a source allowance, including browser
users connecting through the same croc-web bridge. Raising the per-source limit
to the total limit removes the protection against one source filling the pool.
These concurrent handshake limits are separate from the source and room join
rate limits. Fast-admission tokens also use the bounded handshake pool; several
source IPs can still fill it.
To send files using your relay:
```bash
croc --relay "myrelay.example.com:9009" send [filename]
```
Point the printed receive link and QR code at your croc-web site with
`--web-url` or `CROC_WEB_URL`. This is the website origin, not `CROC_STORE_URL`.
```bash
croc --relay "myrelay.example.com:9009" --web-url "https://mycroc.example.com" send [filename]
```
#### Self-host Relay with Docker
You can also run a relay with Docker:
```bash
docker run -d -p 9009-9013:9009-9013 -e CROC_PASS='YOURPASSWORD' docker.io/schollz/croc
```
To send files using your custom relay:
```bash
croc --pass YOURPASSWORD --relay "myreal.example.com:9009" send [filename]
```
To use custom ports, set `CROC_PORTS` (comma-separated) or `CROC_PORT` (base port):
```bash
docker run -d -p 9010-9011:9010-9011 -e CROC_PORTS='9010,9011' -e CROC_PASS='YOURPASSWORD' docker.io/schollz/croc
```
#### Web client
The React/Vite client in [`web/`](web/) can send and receive multiple files andFrequently Asked Questions
What is croc?
croc is a Software Packages library for the Go programming language. Easily and securely send files or folders from one computer to another
How many GitHub stars does croc have?
croc has 41,062 GitHub stars in the directory's latest synchronization.
How do I install croc?
Install croc with the Go module system using `go get schollz/croc`. Check the repository for the current installation instructions.
What category does croc belong to?
croc is listed under Software Packages, specifically Other Software.