Repo of the Day
schollz/croc
Published: Aug 24, 2023
Open repository ↗Easily and securely send things from one computer to another 🐊 📦
Summary
croc is a Go-based command-line tool for transferring files and folders between computers, with end-to-end encryption established via a short code phrase (PAKE). It is designed to work between any two machines without requiring a local server, port forwarding, or account setup, and includes a relay fallback when direct peer-to-peer connection is not possible. The project is MIT-licensed, cross-platform (Windows, Linux, macOS, FreeBSD, Android via F-Droid, and a browser client at getcroc.com), and ships with optional encrypted temporary storage and a shared-terminal mode.
What it is useful for
croc fits the common case of "I need to get a file (or folder) to another machine quickly, securely, and without configuring infrastructure." The README highlights that the sender simply runs croc send and reads out a short code phrase; the receiver types croc <code-phrase> to pull the transfer down. End-to-end encryption is keyed off the code phrase, so the relay only sees ciphertext.
Concrete scenarios documented in the README:
- Moving build artifacts, dumps, or logs between a laptop and a remote server when SSH/SCP is awkward or unavailable.
- Sending a file to a colleague without uploading it to a third-party cloud service, optionally over a SOCKS5 proxy such as Tor.
- Sharing a multi-file payload where the receiver does not need to set anything up: the receiver can be a browser tab at getcroc.com.
- One-off encrypted "share link" delivery via
croc store, which produces a browser link plus a CLI token, with configurable expiration and download limits. - A read/write or read-only shared terminal via
croc sshon Linux, macOS, FreeBSD, or OpenBSD, which establishes a Tailcat WireGuard path pinned to an ephemeral SSH host key.
Documented limitations to be aware of: on Linux/macOS the default invocation exposes the secret in the process name (CVE-2023-43621), so the README recommends CROC_SECRET=... croc or croc --classic; default code phrases are routed across a three-relay pool and custom codes skip probing; croc ssh disables remote commands, port forwarding, and SFTP; and a self-hosted relay requires at least two TCP ports (default 9009–9013).
How engineers can use it
The README documents a one-line installer: curl https://getcroc.com | bash. Package options include brew install croc, choco install croc, pacman -S croc, apk add croc, and on Linux apt install ./croc_VERSION-1_ARCH.deb or dnf install ./croc-VERSION-1.ARCH.rpm. To build from source, the README requires Go 1.27+:
go install github.com/schollz/croc/v11@latest
Typical workflow for sending and receiving:
# Sender
croc send path/to/file-or-folder
# -> "Code is: code-phrase"
# Receiver
CROC_SECRET=code-phrase croc # recommended on Linux/macOS
Other documented flags worth knowing for automation: --yes --overwrite to skip collision prompts, --hash imohash for faster hashing, --quiet for scripted use, --socks5 127.0.0.1:9050 to route through Tor, and --relay host:port to use a self-hosted relay started with croc relay (or its Docker image). For CI or pipelines, the README shows piping with cat file | croc send and receiving to stdout with croc --yes <code> > out. If you hit a step the README does not cover, the project links to design docs under src/docs/ (SSH sharing, stored transfers) and a packaging/README.md.