There are lots and lots of ways to transfer files between two or more computers. You could use server-based file sharing tools, peer-to-peer file sharing apps, USB sticks, external hard disk drives, SCP, NFS, FTP, HTTP, cloud storage platforms and many more. We have covered a few file sharing tools already. Today, we will discuss about yet another utility named Croc. Croc is a command line utility that allows you to easily, quickly and securely transfer files and folders between Computers.
Transferring data using Croc is faster, because it acts as a relay server between the systems. It creates a full-duplex real-time communication layer between the two computers, so the “uploading” and “downloading” tasks occur simultaneously between those computers.
Croc provides end-to-end encryption using Password Authenticated Key Exchange (PAKE) library. For those wondering, the PAKE library allows two people to generate a strong secret key by using a weak key that is known to both beforehand. This secret key is then used for further encryption. Since the key is known by only the sender and receiver, no one else can learn the secret key even if they know the original password.
Croc can be able to transfer multiple files at once between computers. If the data transfer is interrupted for any reason, it can resume file copying from where it was left last time.
Since Croc uses relay, you don't need either a central server or port forwarding. It is a cross-platform application, so you can transfer the data between Linux, Mac and Windows platforms.
In a nutshell, Croc does the following:
- transfers data between two computers using a relay,
- provides end-to-end encryption using PAKE library,
- transfers multiple files in one go,
- Resumes interrupted file copying,
- No central server port-forwarding needed,
- ipv6-first with ipv4 fallback,
- requires Zero dependencies,
- cross platform,
- free and open source.
Croc is written in GO programming language and freely available under MIT license.
Install Croc on Linux
Croc can be installed on any Linux and Unix distributions that supports
Bash using the following command:
$ curl https://getcroc.schollz.com | bash
This command will install Croc in
If you don't want to inject something directly into your
SHELL, you can download the pre-compiled binaries from the releases page and install them using your distribution's package manager.
For instance, I installed Croc deb file on my Ubuntu system using the following commands:
$ sudo apt install gdebi
$ sudo gdebi croc_8.3.2_Linux-64bit.deb
Croc is available in the [Community], so you can install it on Arch Linux and its variants using
pacman like below:
$ pacman -S croc
On NixOS, run:
$ nix-env -i croc
Croc is also available as
$ snap install croc
You can also build Croc from source if you have installed Go on your Linux system.
$ GO111MODULE=on go get -v github.com/schollz/croc/v8
Transfer Files And Folders Between Computers With Croc
Make sure you have installed Croc on all systems.
To transfer a file/folder using Croc, simply run:
$ croc send <file-or-folder-path>
$ croc send file.txt
Croc will generate random code phrase like below.
Sending 'file.txt' (116 B) Code is: slow-tomato-almond On the other computer run croc slow-tomato-almond
Here, the code phrase is
slow-tomato-almond. 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.
To receive the above file on the other computer, the recipient should enter the last line in the above output:
$ croc slow-tomato-almond
Press "y" and hit enter to receive the file.
Accept 'file.txt' (116 B)? (y/n) y Receiving (<-192.168.225.37:9009) file.txt 100% |████████████████████| (116/116 B, 32.966 kB/s) [0s:0s] ✔️
Set custom code phrase
Like I already mentioned, Croc will generate a random code every time you send a file or folder. You can also send files/folders with a custom code of your choice using
$ croc send --code download-this file.txt
"download-this" is the code phrase.
Sending 'file.txt' (116 B) Code is: download-this On the other computer run croc download-this
The recipient can receive the file using the following command:
$ croc download-this
Just like files and folders, we can share the text as well. This can be useful when you want to share a message or URL.
To send text using Croc, run:
$ croc send --text "Welcome to OSTechNix"
Sending 'text' (20 B) Code is: natural-roof-clock On the other computer run croc natural-roof-clock Sending (->[fe80::a00:27ff:fe10:7cc1%wlp9s0]:39916)
The recipient will get text using the following command:
$ croc natural-roof-clock Accept 'text' (20 B)? (y/n) y Receiving (<-[fe80::d710:cf4:bb49:8b20%enp0s8]:9009) Welcome to OSTechNix
You can pipe the file's output to croc like below.
$ cat file.txt | croc send
Sending 'stdin' (116 B) Code is: dexter-cowboy-soprano On the other computer run croc dexter-cowboy-soprano
Croc will automatically use the stdin data and send and assign a filename like "croc-stdin-728899651".
On the receiving end, the user can receive the file using any one of the following commands:
$ croc dexter-cowboy-soprano
$ croc --yes dexter-cowboy-soprano > out
--yes will not ask any confirmation and automatically agree to all prompts.
Set output folder
By default, Croc will download the data in the current working directory. You can make it to use different download location using
$ croc send file.txt
Sending 'file.txt' (116 B) Code is: program-public-mystery On the other computer run croc program-public-mystery
On the receiving end, run:
$ croc --out ~/Downloads
Enter the code phrase when prompted.
For help, run:
$ croc --help NAME: croc - easily and securely transfer stuff from one computer to another USAGE: Send a file: croc send file.txt Send a file with a custom code: croc send --code secret-passphrase file.txt VERSION: v8.3.2-7d155ad COMMANDS: send send a file (see options with croc send -h) relay start your own relay (optional) help, h Shows a list of commands or help for one command GLOBAL OPTIONS: --remember save these settings to reuse next time (default: false) --debug toggle debug mode (default: false) --yes automatically agree to all prompts (default: false) --stdout redirect file to stdout (default: false) --no-compress disable compression (default: false) --ask make sure sender and recipient are prompted (default: false) --relay value address of the relay (default: "18.104.22.168:9009") [$CROC_RELAY] --relay6 value ipv6 address of the relay (default: "[2604:a880:800:c1::14c:1]:9009") [$CROC_RELAY6] --out value specify an output folder to receive the file (default: ".") --pass value password for the relay (default: "pass123") [$CROC_PASS] --help, -h show help (default: false) --version, -v print the version (default: false)
- Share Files Between Linux Desktops With Warpinator
- How To Securely Share Files Over Internet With Firefox Send
- How To Securely Share Files From Commandline With ffsend In Linux
- PSiTransfer – A Simple Open Source Self-hosted File Sharing Solution
- How to Setup A Basic File server Using simpleHTTPserver
- An Easy And Fast Way To Share Files Over Internet From Command Line
- OnionShare – Share Files Of Any Size Securely And Anonymously