How to Install and Use croc to Securely Transfer Files on Linux


Transferring files between computers is a relatively straightforward act if you have the right tool. While most file transfer tools work the same and share a similar feature set, a few stand out with their distinctive features.

Croc is one such tool. It works via the command line and lets you transfer files and folders between computers quickly and securely.

Follow along as we discuss croc and list down the instructions to use it for transferring files between Linux and any other device.

What Is croc?

Croc is a cross-platform file transferring tool that allows you to share files and folders between two computers in a quick and secure manner. It works through the command line and is compatible with all major computer platforms: Linux, macOS, and Windows.

One aspect of croc that separates it from other file-sharing tools is how it handles data transfers. For starters, croc uses a relay server—instead of uploading files to a server, unlike other tools—to create a full-duplex communication layer between the two computers for transferring data. As a result, it's much quicker and doesn't require port forwarding to transmit files.

Similarly, croc employs the PAKE (Password Authenticated Key Exchange) cryptography method to ensure your transferred data remains secure, which is something you usually don't find on other file transfer utilities.

Why Should You Use croc?

Below are some of the standout features of croc that distinguish it from other cross-platform file sharing tools:

  1. Croc uses a relay server to transfer data, which works by creating a full-duplex communication layer that allows for simultaneous uploading and downloading of content on both computers, and in turn, improves transfer rates.
  2. Building upon the previous point, another added advantage of using a relay server is that you don't have to set up port forwarding on the network to transfer data with croc over LAN or over the internet.
  3. Croc uses PAKE, which provides end-to-end encryption to ensure all your data transfers take place securely over the network.
  4. At times when the transfer gets interrupted midway—may be due to a bad connection—the tool lets you resume transfers, so you don't have to go over the process again.
  5. Croc lets you use a proxy, like Tor, to add an extra layer of security to your computer during file transfers.
  6. You can also choose to self-host the relay server using Docker or other similar services.

How to Install croc on Linux?

Croc works on all major Linux distros, and you can install it on your computer using the following steps.

First, download the latest release of croc for your system from the link below.

Download: Croc

To install the DEB package on Ubuntu/Debian, first, launch the terminal. Then, navigate to the directory where you've downloaded the file and type in the following command:

sudo dpkg -i croc-*.deb

Alternatively, if you're on Arch Linux, you can install croc by running:

sudo pacman -S croc

Similarly, to install it on FreeBSD, use:

pkg install croc

If you can't find an installer for your distro, issue the following command to download and execute the installation script:

curl | bash

Since croc facilitates file transfer between two computers, it goes without saying that you also need to have croc installed on the other device. Head over to croc's GitHub to find out instructions on how to install it on your device.

How to Use croc to Share Files

With croc installed on your computers, you can now use it to do both: share files and receive files. So depending on your use case, follow the instructions below to transfer files from/to your Linux computer.

Transfer Files From Linux to Another Device

For situations where you want to transfer files from your Linux machine to some other computer (running another operating system), follow the steps below to carry out the send operation in croc.

Since the entire operation in croc takes place through the command line, make sure you have it opened on both your computers. Then, on your sending device, which is your Linux machine in this case, type the following command in the terminal and hit Enter:

croc send file_name

For example:

croc send MyText.txt
sending files via croc

As soon as you do that, you'll see a code right below the Sending message. This code is what will allow you to receive the files on another computer.

Go back to the command prompt on the receiving computer and enter the command using the syntax below:

croc your_code_here

For instance, if your code is alpha1, you'd need to enter:

croc alpha1

Enter y to accept the incoming file and download it to your device.

Once the code matches on both machines, a PAKE is established and the transfer begins. In addition, the program also generates a secret key for end-to-end encrypted data transfer between both parties.

Although croc's random code phrases do the job, they can sometimes be too long to type. As an alternative, you can generate a custom code yourself when initiating the transfer. For this, modify the command syntax as shown below:

croc send --code your_code_phrase file_name
custom croc code

Similar to sending files, croc also allows you to send text, which can come in handy when you want to share a message or a URL. Use the following syntax to send a text via croc:

croc send --text "your_text_here"

For example:

croc send --text "hello"

On the receiving device, enter the code phrase generated by the above command and hit y, when prompted, to view the message.

Receive Files From Another Device to Linux

Much like sharing files from your Linux computer, there might be times when you'd want to receive files from another device to your Linux machine.

In such situations, you can simply reverse the process, as demonstrated in the steps below.

On the sending machine, open the command line and run:

croc send file_name

Go back to your Linux machine, and in the terminal window, enter:

croc code_phrase
receiving files via croc

Again, enter y to accept the file.

Transferring Files Between Computers With Ease

Most file transferring apps offer cross-platform functionality these days. However, what separates croc from the rest is its ease-of-use, quick and secure nature that facilitates file transfers between computers running different operating systems.

In fact, croc is said to be the only CLI-based file transferring tool with such an extensive feature set, making it a perfect file transfer companion for those who prefer working through the command line.

Having said that, you can also check out qrcp, a free file transfer utility that uses QR codes to help you transfer files between Linux, Android, and iOS.


4 Reasons Why You Don’t Need to Upgrade Your AirPods Every Year

Previous article

How to Create and Scan QR Codes on Chromebook

Next article

You may also like


Leave a reply

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

More in LINUX

Login/Sign up