To temporarily transfer a large file from Windows to Linux, common solutions require either logging into the cloud disk, configuring SSH, opening ports, or setting up a temporary HTTP service. croc reduces the process to sending a command and a phrase: the two ends establish a connection through a relay, and then use PAKE to derive keys for end-to-end encryption.
Supported by Windows, Linux, and macOS, croc can send a single file, multiple files, directories, or short text, and can continue an interrupted transfer. The default public relay is suitable for temporary use; you can also run your own relay when you have more stringent requirements for network boundaries, availability, or connection logging.
Quick Answer
The sender runs:
|
|
The terminal will display a receive phrase similar to example-code-phrase. The Windows receiver runs directly:
|
|
The current recommendation for Linux and macOS is to pass the password via an environment variable to avoid the password appearing in the process name:
|
|
Accept the transfer after confirming that the sender, file name and size are correct. Do not post the receive phrase to group chats, tickets, or public logs; the person who gets the phrase may try to join the transmission.
why croc does not need port forwarding
By default, croc allows both the sender and the receiver to actively connect to the relay. Therefore, even if the two devices are behind different NATs or firewalls, there is usually no need to configure public IP addresses, inbound ports, or local servers.
The relay is responsible for assisting both ends in finding each other and forwarding data. The file content is end-to-end encrypted by the key generated by the sender and receiver through PAKE (Password-Authenticated Key Agreement, Password Authentication Key Agreement). The relay solves the connectivity problem, and the phrase participates in establishing an encrypted session shared by both parties.
This does not mean that password security can be ignored. The automatically generated phrase should be delivered to the recipient through a trusted channel, and the file information should still be verified before transmission. For sensitive environments, connection metadata, terminal history, clipboard and receive directory permissions visible to the relay should also be evaluated.
Install croc
Windows
Use WinGet:
|
|
You can also choose Scoop or Chocolatey:
|
|
|
|
Check the version after installation is complete:
|
|
macOS
Homebrew user runs:
|
|
Using MacPorts:
|
|
Linux
Arch Linux:
|
|
Fedora:
|
|
If the release repository does not have a suitable version, you can download the corresponding file from the official Releases, or use the official installation script:
|
|
It is recommended to download and review the content before executing remote scripts on production devices. When Go 1.22 or higher is already installed, you can also install it from source:
|
|
Send files, directories and multiple items
Send a file:
|
|
Send the entire directory:
|
|
Send multiple files and directories at once:
|
|
When sending the project directory, you can exclude unnecessary dependencies and virtual environments:
|
|
--exclude Receives comma separated names. It is best to confirm the exclusion range before transferring to avoid sending key files, environment variable files, caches and large dependency directories together.
Customize receiving phrase
The default random phrase is suitable for most situations. If you need to communicate by phone, etc., you can specify a phrase of at least six characters:
|
|
The custom phrase must be difficult enough to guess. Do not use project names, phone numbers, dates, or weak passwords like 123456. Phrases should only be given to the intended recipient and not reused in other documents after transmission.
Linux and macOS receivers recommend using this:
|
|
In a trustworthy single-user system, the behavior of taking phrases directly as parameters can be restored in the classic way:
|
|
The classic method is more convenient, but the password may be exposed to other processes or monitoring tools on the machine through process parameters. This setting is not recommended for servers shared by multiple people.
Send text, use pipes and QR codes
Send short text or URL:
|
|
Send content from standard input:
|
|
Write directly to the file after receiving:
|
|
When sending to the mobile phone, you can have the terminal display the QR code:
|
|
The QR code also contains the information required to join the transmission and should not be displayed in public live streams, screenshots or recordings.
How to use breakpoint resume transfer
croc supports resuming interrupted transfers. After the network is disconnected, keep the original file at the sender and some files that have been written by the receiver, and then rerun the transfer process. When there are significant changes in the receive path, file contents, or relay conditions, recovery may not work as expected.
Pay attention to three points during actual operation:
- Do not delete or rename the unfinished files on the receiving end;
- Do not modify the sending source file before recovery;
- Confirm that the remaining space on the disk is enough to accommodate the complete file.
If recovery fails repeatedly, first use a small file to test the connectivity between both ends and the relay, and then check whether the versions are too different, whether the proxy is stable, and whether the security software intercepts the connection.
Transfer via SOCKS5 proxy
croc can specify a SOCKS5 proxy. For example, the native agent listens to 127.0.0.1:9050:
|
|
Proxies affect connection paths and speeds, but do not replace the encryption of croc itself. Whether the receiving end also needs a proxy depends on its network environment. When troubleshooting, you should separately verify whether the proxy port, DNS processing method, and relay address are reachable.
Self-built croc relay
The easiest way is to run it directly on the server:
|
|
By default, TCP port 9009-9013 is used. Provide at least two ports when customization is required:
|
|
The sender specifies a self-built relay:
|
|
Use Docker and set a password for relay:
|
|
Provide the relay address and password when sending:
|
|
Before deployment, you need to release the actual TCP ports in the cloud firewall and host firewall. The relay password should not be written directly into a shared script, shell history, or public Compose file; it is more appropriate to inject it from a controlled environment variable or key management system.
A self-built relay can control relay location, access policy, and availability, but it cannot replace endpoint security. When the sending end is implanted with malicious programs, the receiving directory permissions are incorrect, or the phrase is leaked, self-built servers cannot solve these problems.
Parameters that require caution when automating
The following command skips confirmation and allows files with the same name to be overwritten:
|
|
It is suitable for automated tasks that are clearly controlled and not suitable for running casually in untrusted directories. The default confirmation prompt can help detect file name, size, or source anomalies. Do not enable both --yes and --overwrite unless the script has independently verified the receiving target.
Silent sending can be done using:
|
|
Silent mode reduces log output and may mask the cause of failure. The exit code should be checked at the same time in the scheduled task, and the error output should be written to the protected log.
Common troubleshooting
After inputting phrases at both ends, the connection has been unable to occur.
First confirm whether the croc version, system time and network access at both ends are normal, and then check whether the company’s firewall, proxy or operator blocks the relay port. You can try again with a small file to determine whether the problem comes from the connection or the file itself.
Running croc 短语 directly on Linux or macOS does not meet expectations
The new version recommends putting the phrase into CROC_SECRET:
|
|
This is to reduce the risk of the phrase being leaked via the process name, not the installation failure.
A file with the same name already exists on the receiving end
Prioritize keeping the confirmation prompt and check the source before deciding whether to overwrite it. --yes --overwrite is only considered if the script has verified the file identity and target path.
Self-built relay can connect but cannot transmit
Verify that the entire port range is mapped and released, not just the first port. The default relay uses 9009-9013; when customizing the scope, the Docker mapping, host firewall, cloud security group, and croc startup parameters must be consistent.
Which scenarios is croc suitable for?
croc is very suitable for temporarily transferring files across platforms, remotely assisting users to export logs, transferring build products between devices without SSH accounts, and migrating directories from old computers to new computers. It does not require both parties to register accounts, nor does it require the receiving end to open an inbound port.
If long-term synchronization, version history, team rights management, or large-scale backups are required, Syncthing, object storage, rsync, or a dedicated backup system are often more suitable. croc is positioned to simplify one-time or short-term transfers, not to replace a complete data management solution.
Summary
croc compresses cross-network file transfer into three steps: “send file, share phrase, receive confirmation”, while retaining end-to-end encryption, cross-platform, breakpoint resume and self-built relay capabilities. Just use the default public relay for daily use; sensitive or controlled networks can deploy their own relays but still protect receive phrases, endpoint history, file permissions, and endpoint devices.
Project address: schollz/croc