Effortlessly transfer files across computers
Mere mortals use USB drives to transfer files, but Shashank Sharma wants convenience and security. Luckily, the right tool is just a command away…
The biggest downside to using USB drives for transferring files between machines is their size limitation. At least, until you leave the USB drive on a bench in the park, or a coffee table. That’s when you realise that security is the bigger issue. This is why file transfer utilities are so popular. Most provide a convenient mechanism to share files across machines. Croc is one such command-line utility, with an impressive feature set.
Unlike many file-sharing utilities that only support transfer of files between machines on the same network, Croc enables you to transfer files to any internet-capable machine. Not only that, the utility boasts of end-to-end encryption, and supports resuming partial or incomplete file transfers.
Go Croc
You’ll have to install Croc on both machines before you can use it to transfer files. Released under the MIT licence, the cross-platform utility can be run on Windows, BSD and Mac, apart from Linux distributions.
Most Linux distribution don’t carry Croc in their software repositories, but the installation is still fairly straightforward. The project provides ARM, as well 32and 64-bit Deb packages apart from source tarballs. If you already have Go installed on your distribution, you can also build Croc from source, but the easiest way to install it is with the official installation script.
Open a terminal and run the curl https://getcroc. schollz.com | bash command. The curl utility fetches the installation script, which is then executed by bash.
A key advantage that Croc has over other similar tools is that it can be used without involving port forwarding.
Traditionally, port forwarding is required when a machine on the internet tries to connect with a device that’s behind a firewall or NAT. Croc does away with having to use port forwarding because it acts as a relay server between the different machines. If the sender and receiver machines are on the same LAN, Croc uses a local relay, otherwise it utilises a public relay.
Another advantage of using this relay-based transmission is that Croc creates a full-duplex real-time communication layer between the two machines. As a result, the ‘uploading’ and ‘downloading’ occurs simultaneously between the machines. This is why Croc is faster compared to other similar file-sharing tools.
To ensure that the data being transmitted through the relay remains secure, Croc uses passwordauthenticated key agreement (PAKE). Essentially, Croc creates a code-phrase when you attempt to transmit a file. This code-phrase must be specified on the recipient machine otherwise Croc won’t initiate the transfer.
Sharing is easy
Using Croc is fairly straightforward. To send a file, all you need to do is run the croc send
Sending ‘vakalatnama.pdf’ (1.8 MB)
Code is: 8411-support-process-traffic
On the other computer run
croc 8411-support-process-traffic
As you can see, the croc send command generates a random code phrase, and you’re informed to execute the croc
$ croc 8411-support-process-traffic
Accept ‘vakalatnama.pdf’ (1.8 MB)? (Y/n)
Receiving (<-192.168.0.12:54496)
100% | | (1.8/1.8 MB, 36.540 MB/s) $
The file is downloaded into the current working directory after you type Y to accept the incoming transmission. If you want to download the file to a different directory, you must run the croc –out
Once the transmission begins, Croc displays a progress bar on both the sender and recipient machines, and also shows the IP address of the respective machines as well as the respective upload/ download speeds. That is, on the recipient machine Croc will show the IP address of the sender machine, and vice versa on the sender machine.
On the sender machine, Croc exits automatically once the file is downloaded on to the recipient machine. The code phrase remains valid only so long as Croc is still running on the sender machine. Once it exits, you can’t run the download again – that is, you can’t use the same code phrase to initiate the transfer again.
Multiple send features
When sharing files, you can send multiple files, as well as folders with the croc send command. This table presents your options:
Another standout feature of Croc is its ability to resume aborted downloads. So, when you initiate the transfer again, by running the croc send command on the sender machine again, Croc will resume the downloads instead of starting from scratch.
If you don’t want to be presented with a random code phrase, you can also specify your own with
croc send --code
Unlike most other similar utilities that allow file transfers, you can even use Croc to transmit text messages. This is useful as instead of entering the text into a file, and the sending over the file, only the text can be shared directly from the terminal. You must use the
croc send --text “Your message" command to do this. The process for the recipient remains the same:
$ croc 3575-product-vanilla-active
Display text message (13 B)? (Y/n)
Receiving (<-127.0.0.1:54902)
Overwrite ‘croc-stdin-2653920262'? (y/N) y This is far more creative a message than a vanilla
Hello, World! $
Should you require any assistance with a feature, or encounter a bug, or wish to request a new feature, then you can do so from the project’s GitHub page. Make sure to browse through the open and closed issue so as to not report a bug, or request a feature that’s already in the works.
While cross-platform file sharing utilities aren’t a rarity, you would be hard pressed to find one that works from the command-line and boasts of such an impressive feature set. Croc stands out not only for its straightforward installation, but also useful features such as resumable, encrypted transfers.