AcloudA

How to Transfer Files to-and-from Ubuntu through Magic Wormhole

Posted by Karim Buzdar on August 27, 2019
Tags: ,


The Magic Wormhole package comes with a library and a command-line tool named Wormhole. This tool lets you transfer arbitrary-sized files and directories, and even pieces of text from one computer to another. The two endpoints are identified by using identical “wormhole codes”: in general, the sending machine generates and displays a human-pronounceable code, which must then be typed into the receiving machine. This article is about installing the Wormhole command line utility on the source and target Ubuntu systems. Then, presenting an example of securely sending a file from one Ubuntu system to the other using Wormhole.

Note: You can easily run the mentioned commands and procedures on a Ubuntu 18.04 LTS.

Setting up Source and target systems

Before sharing files between two Ubuntu systems, they both need to have the Wormhole application installed on them. We will be installing the application through the default Ubuntu command line application called the Terminal. The simplest way to open the Terminal is either through the Ctrl+Alt+T shortcut or through the Application Launcher search(accessible through the Super/Windows key). Please follow the steps described below, individually on both the systems, so that they are both ready for the file exchange:

Step 1: Update the local repository index

When we use the apt/apt-get commands, they check for the version of a software listed in your local repository index. If you want to install the latest version of a software available on the Internet repository rather than in the local, you need to update your system’s repository index.

Since adding, updating and configuring software on Ubuntu requires administrative privileges, we will run all such commands as a sudo user.

So, let us run the following command to update the apt-get index:

update the apt-get index

Please provide the password for sudo and the system will be configured accordingly.

Step 2: Install the Snap Daemon

The snap command lets you install, configure, refresh and remove snaps. Snaps are packages that work across many different Linux distributions, enabling secure delivery and operation of the latest apps and utilities. The Wormhole application is available in the Snap store and can be installed easily through the Snap daemon.

Run the following command, as sudo, in order to install the Snap daemon on your Ubuntu:

install the Snap daemon on your Ubuntu

The installation requires the use of some additional space on your system. The system might ask you if you are OK with this use of extra space through a y/n prompt. The installation should begin as you press Y and then hit the Enter key.

Step 3: Install the Wormhole application from the Snap Store

With the Snap command installed on your system, you are one command away from installing Wormhole, and here is that command:

installing Wormhole

The application will then be installed on your system. The output, as shown above, will notify you that the application is now installed.

Please do not forget to run the same procedure on the destination Ubuntu system as well.

Some helpful commands

Here are some commands that will be useful as you start working with this application:

1. This command will print the version number of the said software and also verify anytime that it is indeed installed on your system:

2. The following commands will display the basic usage of the Wormhole command:

Transferring a file through Magic Wormhole

Now that the Wormhole utility is installed on your system, all you need to do is to make use of a single send command to transfer a file to another computer.

Here is the syntax of the Wormhole ‘send’ command:

For a single file:

For an entire directory:

Example:

In this example, I will be sending a file named samplefile.docx, located in my Downloads folder, as follows:

samplefile.docx

As soon as you run a send command, the application will display a Wormhole Code. Luckily, this code is nothing like the usual mumble jumble of ASCII characters. It is more of a human-friendly and even verbally communicable set of words; see if you can spot “3-apollo-spearhead” in the above screenshot. If you read it out loud, you will find it easily pronounceable.

Anyways, after generating this code, your system is now in a waiting state. It has already sent an encrypted file to be fetched by the destination computer.

Receiving a transferred file, through Wormhole

On your destination Ubuntu system, that already has Magic Wormhole installed, use the following syntax of the Wormhole receive command:

For example, in the following screenshot, I have used the receive command by using the code generated in the previous section of the article:

$ wormhole receive [wormhole_code]

Note: Please do not get bothered by the similar Terminal prompt as the source computer in the above screenshot. I have, as a trial, used my own computer to receive the file.

As soon as I enter the command, the file will be saved in the destination system, in the current directory. You can verify this by running the ls command as follows:

The highlighted file is the one I have recently received.

As soon as the file is received, Wormhole will display the following notification on the host computer:

Wormhole will display the notification

That is how you could get through a fast, secure and convenient way of sending files on Ubuntu through the command line Magic Wormhole utility.

Related materials:

Views All Time
3
Views Today
5
Return to all posts

Deploying Ubuntu VM in Azure with Remote Desktop Access
Getting started with MySQL on Amazon RDS