Magic Wormhole: The Simple, Secure Way to Teleport Files Between Computers

Mohamed Nossirat

Introduction

We've all been there. You're with a friend, you have an 8GB file or a beloved Dreamcast ROM on your laptop, and you need to get it to their computer. The usual rituals begin: the frantic search for a USB stick, the agonizing wait for a Google Drive upload, or the fiddly setup of a shared folder. It feels like too much work for a simple, one-time transfer.

There's a better way, and it lives right in your terminal. It's called Magic Wormhole, and it's the closest thing to teleportation for your files.

What Exactly is Magic Wormhole?

Created by Brian Warner and demonstrated at PyCon 2016, Magic Wormhole is a command-line tool that does one thing and does it brilliantly: it gets things from one computer to another, directly, safely, and simply.

It’s not another cloud service. Think of it as a direct, secure pipe between two computers. You use it when you're talking to someone in person, over the phone, or via chat but their computer isn't connected to yours in any pre-arranged way. No accounts, no configurations, no central server storing your data. It's a "one-time" transfer: you send a file, they receive it, and the connection vanishes.

"Rather than upload your file to Dropbox and give the other person its link, you can just send it to them directly."

Installation

Getting Magic Wormhole on your machine is easy, regardless of your operating system.

Linux (Ubuntu/Debian/Raspbian):

sudo apt install magic-wormhole

Linux (Fedora):

sudo dnf install magic-wormhole

macOS:

brew install magic-wormhole

Windows: The best way is to use pip inside a virtual environment:

pip install magic-wormhole

For detailed instructions on other distros or potential dependencies, check the project's official repository.

How It Works

Its simplicity is its superpower. Here’s how you'd use it in real life: To Send a File: You open a terminal and type:

wormhole send /path/to/file.[ext]

The tool springs to life. It prepares the file and then presents you with a unique, human-readable code phrase, like: 7-cactus-sunshine.

To Receive: You tell your friend the code phrase. They open their own terminal and type:

wormhole receive

The tool will prompt them for the code. They type in 7-cactus-sunshine, hit Enter, and the transfer begins. The file flows directly from your computer to theirs. Once it's done, the code expires. That's it. One command and a simple, spoken phrase is all it takes.

Or directly:

wormhole receive 7-cactus-sunshine

Sharing SSH Keys

In the world of DevOps, securely sharing SSH keys is a fundamental task. Whether you're onboarding a new teammate or granting access to a server, the process needs to be both safe and simple.

That’s where Magic Wormhole comes in. It provides dedicated commands wormhole ssh invite and wormhole ssh accept designed specifically to make SSH public key exchange fast, secure, and hassle-free.

When you want to grant a new user access to your server, the wormhole ssh invite command is a quick and secure solution.

Open a terminal and run:

wormhole ssh invite

You’ll then see a message like this:

Now tell the other user to run:

wormhole ssh accept 2-norwegian-frighten

Simply share the generated code with the other user.

Once they run the command, their public SSH key is automatically added to your ~/.ssh/authorized_keys file giving them authorized access to your server.

You can also specify which system user the key should belong to, making it flexible for multi user environments.

If you’re on the receiving end of an invitation, you’ll use:

wormhole ssh accept <code>

If you have multiple public SSH keys, you may see something like this:

Multiple public-keys found:
  0: id_first.pub
  1: id_secoind.pub
  2: id_third.pub
Send which one?:

Simply choose the key you want to share.

This securely sends your public SSH key to the server owner, allowing them to seamlessly add it to their authorized_keys file.

With Magic Wormhole, sharing SSH keys becomes a smooth, secure DevOps workflow no risky email attachments, no insecure chat transfers, and no complicated setup.

Why You'll Love It

  • Dead Simple to Use: If you can open a terminal and read a few words aloud, you can use Magic Wormhole. It's designed to be as easy as rsync, but for people who haven't pre-configured SSH keys.

  • Truly Secure: The entire transfer is end-to-end encrypted. The code phrase you speak isn't just a password; it's the key to decrypt the data. Only the person with the code can access the file. This makes it far more secure than sharing a public link.

  • No File Size Limits: Since it's a peer-to-peer transfer, you're only limited by your internet upload speed and the patience of your friend on the other end. That 8GB video file or entire folder of games is no problem.

  • Self-Hostable and Open Source: For the more experienced user, you're not locked into a proprietary service. The servers that help establish the initial connection are open-source, meaning you can even host your own.

Notes on Security and Use Cases

While Magic Wormhole is encrypted, one author wisely notes a common sense guideline: "This is fine for the odd file, but I would never trust any sensitive data with a tool such as this. Follow the security guidelines where you work!" It's perfect for sharing game ROMs, e-books, large presentation files, or family videos. For top-secret corporate data, your organization's approved methods should always come first.

For the Linux nerds who might ask, "Why not just use scp or rsync?", the answer is simple: prior arrangements. Those tools require you to have pre-exchanged keys or know the recipient's IP address and username. Magic Wormhole requires nothing but a quick verbal exchange.

Conclusion

Magic Wormhole fills a specific but incredibly common gap. It's for the moments when you just need to get a file from point A to point B without the overhead of the cloud or the hassle of physical media. It's simple, secure, and satisfyingly magical.

So next time a friend asks for a file, skip the USB hunt. Just open your terminal and whisper the magic words.