9 Practical Croc File Transfer Examples for Linux

Moving a file from one machine to another should be simple, yet I still watch people email themselves zip archives or fight with scp flags. Croc file transfer solves this with a single command and a short code phrase. You run croc send file.pdf on one machine, type the code phrase on the other, and the file arrives encrypted end to end. No accounts, no port forwarding, no public IP required.

The croc project on GitHub sits at over 38,000 stars, and it earned them. I reach for it whenever two machines are on different networks and I don’t feel like setting up SSH keys for a one-off copy.

How Croc File Transfer Works

Croc file transfer relies on a relay server to connect the two ends. When you run croc send, the tool generates a code phrase like 7134-collect-dublin-vibrate. The receiver types that phrase, both sides authenticate through PAKE (password authenticated key exchange), and the transfer starts.

PAKE matters here. The code phrase never travels over the wire in a usable form, so the relay operator cannot read your data. Everything is encrypted end to end with a key derived from that phrase. If both machines sit on the same LAN, croc detects this and sends the data directly, skipping the relay entirely.

Transfers also resume. Kill a 4 GB copy at 80 percent, run the same command again with the same code phrase, and croc picks up where it stopped.

Installing Croc on Linux

The quickest route is the install script from the project:

curl https://getcroc.schollz.com | bash

If you prefer a package manager, croc is in most repos:

# Debian/Ubuntu
sudo apt install croc

# Fedora
sudo dnf install croc

# Arch
sudo pacman -S croc

# macOS
brew install croc

It also ships as a single static Go binary, so you can drop it on a server without touching the package manager. Windows, macOS, Linux, BSD, and even Android via Termux all run the same tool, which is half the appeal. The sender can be on a Linux VPS and the receiver on a Windows laptop.

9 Practical Croc Examples

1. Send a single file

croc send backup.tar.gz

Croc prints the code phrase. On the receiving machine, run croc followed by the phrase:

croc 7134-collect-dublin-vibrate

2. Send a whole folder

croc send ~/projects/website/

Directories are sent recursively with their structure intact. No need to tar anything first.

3. Pick your own code phrase

croc send --code blue-pelican-42 report.pdf

Handy when you’re dictating the phrase over a phone call. Keep it long enough to resist guessing, since the phrase is the only secret protecting the transfer.

4. Send raw text

croc send --text "the database password is in vault under /prod/db"

This beats pasting secrets into a chat app that logs everything forever.

5. Receive without confirmation prompts

croc --yes 7134-collect-dublin-vibrate

The --yes flag skips the accept prompt, which you want in scripts.

6. Send to a specific folder

croc --out /srv/incoming 7134-collect-dublin-vibrate

7. Force local network transfer

croc send --local large-vm-image.qcow2

The --local flag refuses the public relay and only transfers over the LAN. On gigabit Ethernet I’ve moved multi-gigabyte VM images at wire speed this way.

8. Run your own relay

croc relay

This starts a relay on port 9009. Point both ends at it with --relay your-server:9009. Useful when company policy forbids third-party infrastructure, or when you want predictable throughput.

9. Exclude files from a folder send

croc send --exclude "*.log,node_modules" ~/projects/app/

How Fast Is Croc File Transfer

Speed depends on the path the data takes. Over a LAN with the direct connection, croc file transfer saturates the link. I’ve clocked around 110 MB/s on gigabit Ethernet moving a 6 GB disk image, which matches what rsync does on the same hardware.

Through the public relay, throughput varies with your distance from it and how loaded it is. Expect anywhere from 5 to 30 MB/s across continents. Croc opens multiple parallel TCP streams by default, which helps on high-latency links where a single stream would crawl. If relay speed becomes a bottleneck for regular use, self-hosting a relay on a VPS near both endpoints fixes it.

Why Croc File Transfer Beats scp for One-Off Copies

scp needs SSH access, which means keys or passwords, a reachable port 22, and a user account on the target. That’s fine between servers you administer. It falls apart when the other end is a colleague’s laptop behind hotel Wi-Fi.

Croc file transfer needs none of that. Both sides connect outward to the relay, so NAT and firewalls stop being your problem. Compare this with magic-wormhole, the Python tool that pioneered the code phrase approach. Croc took the same idea and added resumable transfers, multiplexed parallel streams for speed, and a single binary with no Python runtime to install.

For recurring syncs between fixed machines, rsync over SSH is still the right call. Croc is for the transfers you didn’t plan.

When Not to Use Croc File Transfer

The default setup routes through a public relay run by the project maintainer. The relay cannot decrypt your data, but it does see connection metadata such as IP addresses and transfer sizes. If that bothers you or your compliance team, run your own relay as shown in example 8.

Croc file transfer is also interactive by design. For unattended nightly jobs, stick with rsync, or wire up croc with --yes and a pre-shared code phrase only if you understand that anyone holding the phrase during that window can grab the file. And like any tool that moves data past your firewall, croc file transfer deserves a mention in your security policy before the whole team adopts it.

Debugging a transfer that stalls? Watch the connection with tcpdump, which I covered in the tcpdump network troubleshooting guide, or check latency to the relay with gping. For stranger plumbing between sockets, socat remains the duct tape of networking.

Verdict

Croc has replaced scp for every ad hoc copy I make between machines that don’t already share SSH trust. The code phrase model gets encryption right without asking the user to think about it, and resumable transfers save real time on flaky connections. Install it on every box you touch. The next time someone asks how to send you a 2 GB file, give them one command and a four-word phrase instead of a lecture about SFTP clients.

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts