Croc: Transfer Files and Folders Securely Between Computers

Croc is a free and open-source command-line tool that allows two computers to transfer files and folders using code phrases securely.

There are lots of ways to transfer files between two or more computers. Today, we will discuss yet another utility named Croc. This tutorial will show you how to install Croc and use it to transfer files between computers securely.

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.

Croc’s key advantages are speed, security, and simplicity, all in one. In addition, transferring data using Croc is faster because it acts as a relay server between the systems.

In addition, it creates a full-duplex real-time communication layer between the two computers, so the “uploading” and “downloading” tasks coincide between those computers.

Croc is a cross-platform tool. It is written in GO programming language and freely available under an MIT license. You can install it on Linux, Mac, Windows, and Android and securely transfer files between them.

Moreover, Croc does not only work on the same LAN but on any two computers connected to the internet.

How to Install Croc Secure File Transfer App on Linux

Ubuntu and Other Debian-based Distros

Download the latest release (.deb package) from the project GitHub page. At the moment of writing it is version 9.5.5.

We will use the wget command to download it:

wget https://github.com/schollz/croc/releases/download/v9.5.5/croc_9.5.5_Linux-64bit.debCode language: JavaScript (javascript)

Then you can install it by running apt install, followed by the full path to the downloaded file:

sudo apt install ./croc_9.5.5_Linux-64bit.deb
How to install Croc secure file transfer app on Linux

If you would like to learn more about installing locally downloaded DEB files using the APT command, we recommend our great guide: How to Install deb Files in Ubuntu (with Examples).

Arch Linux and Other Arch-based Distros

pacman -S croc

Other Distros

The command shown below will install croc in /usr/local/bin/ location.

curl https://getcroc.schollz.com | sudo bashCode language: JavaScript (javascript)
How to install Croc secure file transfer app on Linux

How to Securely Transfer Files Between Computers Using Croc

Using the croc command to send a file or folder from your computer to any other computer is as simple as it can get. So first, Croc must be installed on both computers; the one that’s sending the files and the other that is receiving them.

To transfer a file/folder using croc, run:

croc send <file-or-folder-path>Code language: HTML, XML (xml)

Example:

croc send documents.zipCode language: CSS (css)
Sending file using Croc

Croc will generate random code phrases like the above. Here, the code phrase is 8344-think-unit-pulse.

The code phrase is used to establish a 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 8344-think-unit-pulse.

Running this command will establish the connection with the sender, secure the channel, and ask you if you want to download whatever is being sent.

croc 8344-think-unit-pulse
Receiving file using Croc

Once you accept the transfer, the download will begin, and you will see the progress in your terminal emulator. The same thing goes for the sender.

If you check the terminal on the machine sending the file, you will see the transfer progress.

Sending file using Croc

Set Custom Croc’s Code Phrase

You can also securely transfer files or folders with a custom code of your choice using the --code option.

croc send --code psforevermore documents.zipCode language: CSS (css)
Sending file using custom code phrase with Croc

The recipient can receive the file using the following command:

croc psforevermore
Receiving file using custom code phrase with Croc

How to Securely Transfer Text Messages Using Croc

You can also use Croc to send a 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 color of my life"Code language: JavaScript (javascript)
Securely send text message using Croc

The recipient can receive the text using the following command:

croc 4727-dallas-modem-retro
Securely receive text message using Croc

Use Croc with Your Relay Server to Securely Transfer Files

Now, baked into Croc’s configuration is using a public relay server that Croc’s creator has set up, but one can set up their relay server and configure croc to use it at runtime. To do this requires a one-time setup.

Run croc as a relay process on a server with a public address, for example, 20.237.185.29:

croc relay
Setting up own Croc relay server

Note also that ports 9009 through 9013 must be open on the firewall for network communication.

Then, we point croc away from the default public relay when sending a file:

croc --relay "20.237.185.29:9009" send documents.zipCode language: CSS (css)
Securely send files with Croc via custom relay

Then on the receiving end:

croc --relay 20.237.185.29:9009 1144-detect-linear-salmonCode language: CSS (css)
Securely receive files with Croc via custom relay

Closing Thoughts

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 a tool 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.

Bobby Borisov

Bobby Borisov

Bobby, an editor-in-chief at Linuxiac, is a Linux professional with over 20 years of experience. With a strong focus on Linux and open-source software, he has worked as a Senior Linux System Administrator, Software Developer, and DevOps Engineer for small and large multinational companies.

Think You're an Ubuntu Expert? Let's Find Out!

Put your knowledge to the test in our lightning-fast Ubuntu quiz!
Ten questions to challenge yourself to see if you're a Linux legend or just a penguin in the making.

1 / 10

Ubuntu is an ancient African word that means:

2 / 10

Who is the Ubuntu's founder?

3 / 10

What year was the first official Ubuntu release?

4 / 10

What does the Ubuntu logo symbolize?

5 / 10

What package format does Ubuntu use for installing software?

6 / 10

When are Ubuntu's LTS versions released?

7 / 10

What is Unity?

8 / 10

What are Ubuntu versions named after?

9 / 10

What's Ubuntu Core?

10 / 10

Which Ubuntu version is Snap introduced?

The average score is 69%