Croc is a free and open-source command line tool that allows any two computers to simply and securely transfer files and folders using code phrases.
Table of contents
There are lots of ways to transfer files between two or more computers. Today, we will discuss about yet another utility named Croc. This tutorial we’ll show you how to install Croc and how to use it to securely transfer files between computers.
Croc is a file transfer system that sends files securely using end-to-end encryption, via a file transfer relay. If you are curious about the name, it is inspired by the fable of the frog and the crocodile. The Croc key advantages are speed, security, and simplicity, all-in-one. 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 is a cross-platform tool. It is written in GO programming language and freely available under MIT license. You can install it on Linux, Mac, Windows, and Android, and securely transfer files between them. Croc does not only work in same LAN but on any two computers connected to the internet.
How to Install Croc Secure File Transfer App on Linux
Ubuntu / Debian
Download the latest release (.deb package) from the project website. Then you can install it by running
apt install followed by the full path to the downloaded file:
apt install /home/linuxiac/Downloads/croc_9.1.3_Linux-64bit.deb
Reading package lists… Done Building dependency tree Reading state information… Done Note, selecting 'croc' instead of '/home/linuxiac/Downloads/croc_9.1.3_Linux-64bit.deb' ... Unpacking croc (9.1.3) … Setting up croc (9.1.3) …
pacman -S croc
The command shown bellow will install
curl https://getcroc.schollz.com | bash
How to Securely Transfer Files Between Computers Using Croc
croc command to send a file or folder from your computer to any other computer is as simple as it can get. Of course,
croc needs to be installed on both computers, the one that’s sending the file(s) and the one receiving them.
To transfer a file/folder using
croc, simply run:
croc send <file-or-folder-path>
croc send stuff.tar.gz
Did you mean to send 'stuff.tar.gz'? (y/n) y Sending 'stuff.tar.gz' (640 B) Code is: 1846-jump-mega-clean On the other computer run croc 1846-jump-mega-clean
Croc will generate random code phrase like above. Here, the code phrase is
1846-jump-mega-clean. 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. This ensures secure file transfers.
On the second computer (receiver), to receive the file or folder all you have to do is type
croc <passphrase> (in this case it’s
croc 1846-jump-mega-clean). Running this command will establish the connection with the sender, secure the channel and will ask you if you want to download whatever is being sent.
Accept 'stuff.tar.gz' (640 B)? (y/n) y Receiving (<-18.104.22.168:32816) 100% |████████████████████| (640/640 B, 5.479 kB/s)
Once you accept the transfer the download will begin and you will see the progress in your terminal emulator. Same thing goes for the sender. If you check the terminal on machine that’s sending the file, you will be able to see the transfer progress.
Sending (->22.214.171.124:38244) 100% |████████████████████| (640/640 B, 418.001 kB/s)
Set Custom Croc’s Code Phrase
You can also securely transfer files or folders with a custom code of your choice using
croc send --code ps-forevermore stuff.tar.gz
Sending 'stuff.tar.gz' (640 B) Code is: ps-forevermore On the other computer run croc ps-forevermore
The recipient can receive the file using the following command:
Accept 'stuff.tar.gz' (640 B)? (y/n) y Receiving (<-126.96.36.199:38016) 100% |████████████████████| (640/640 B, 5.752 kB/s)
You can also use
croc to send text. This can be useful when you want securely to share a message or URL. To do that all you have to do is type:
croc send --text "You're the colour of my life"
Sending 'text' (28 B) Code is: 1682-ozone-albert-celtic On the other computer run croc 1682-ozone-albert-celtic
The recipient can receive the text using the following command:
Display text message (28 B)? (y/n) y Receiving (<-188.8.131.52:42302) You're the colour of my life
Use Croc with Your Own Relay Server to Securely Transfer Files
Now, baked into Croc’s configuration is the use of a public relay server that Croc’s creator has set up, but one can set up their own relay server, and configure
croc to use that relay server at runtime. To do this requires a one-time setup on a third computer or in a docker container.
croc as a relay process on a server with a public address, for example
[info] 2021/05/12 19:36:22 starting croc relay version v9.1.3-e29b4c4 [info] 2021/05/12 19:36:22 starting TCP server on 9009 [info] 2021/05/12 19:36:22 starting TCP server on 9011 [info] 2021/05/12 19:36:22 starting TCP server on 9013 [info] 2021/05/12 19:36:22 starting TCP server on 9012 [info] 2021/05/12 19:36:22 starting TCP server on 9010
Then, we point
croc away from the default public relay when sending a file:
croc --relay "184.108.40.206:9009" send some_file.extension
Sending 'stuff.tar.gz' (640 B) Code is: 3036-finance-value-temple On the other computer run croc --relay 220.127.116.11:9009 3036-finance-value-temple
Then on the receiving end:
croc --relay 18.104.22.168:9009 3036-finance-value-temple
Accept 'stuff.tar.gz' (640 B)? (y/n) y Receiving (<-22.214.171.124:41106) 100% |████████████████████| (640/640 B, 3.918 kB/s)
In a nutshell, Croc does the following:
- Securely transfer files, folders, and text 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
- Requires Zero dependencies
- Cross platform
- Free and open source
Croc is definitely a tool that you need to check out if you are looking for a secure file transfer solution. There’s a lot more you can do with it and we encourage you to read the author’s blog post about the tool.