20200625-magic_wormhole.md (2766B)
1 Have you ever needed to quickly send a file, directory, or even some text from one computer to another? Maybe you don't have SSH set up, or any way of using `rsync`/`scp`. If you are talking to a friend and want to quickly send them a file there are many ways of doing it but I think Magic Wormhole is one of the quickest (after setup). Once installed you can issue a send command and be presented with an "short and human-pronounceable" code which you use with the receive command on the other computer. 2 3 The code can be found on [Github](https://github.com/warner/magic-wormhole) and the documentation on [Read the Docs](https://magic-wormhole.readthedocs.io/en/latest/). 4 5 Magic Wormhole may be available in your package manager or you can install from `pip`. These are the steps I took to setup. 6 7 First I created a python virtual environment then installed the `magic-wormhole` package 8 ``` 9 python3 -m virtualenv /path/to/wormhole_venv 10 source /path/to/wormhole_venv/bin/activate 11 (wormhole_venv) pip install magic-wormhole 12 (wormhole_venv) deactivate 13 ``` 14 15 To make my life a little easier I created a link to the `wormhole` command in a directory in my $PATH 16 ``` 17 ln -s /path/to/wormhole_venv/bin/wormhole ~/bin/wormhole 18 ``` 19 20 Now I can send a file to a friend 21 ``` 22 wormhole send funny.jpg 23 24 Sending 254.7 kB file named 'funny.jpg' 25 Wormhole code is: 2-hemisphere-ruffled 26 On the other computer, please run: 27 28 wormhole receive 2-hemisphere-ruffled 29 ``` 30 31 Wormhole waits for the transfer to take place. On my friend's computer they can receive the file 32 ``` 33 wormhole receive 2-hemisphere-ruffled 34 Receiving file (254.7 kB) into: funny.jpg 35 ok? (Y/n): Y 36 Receiving (->tcp:127.0.0.1:33985).. 37 100%|████████████████████████████████████████| 255k/255k [00:00<00:00, 1.77MB/s] 38 Received file written to funny.jpg 39 ``` 40 41 My send is now complete 42 ``` 43 Sending (<-127.0.0.1:41324).. 44 100%|████████████████████████████████████████| 255k/255k [00:00<00:00, 54.1MB/s] 45 File sent.. waiting for confirmation 46 Confirmation received. Transfer complete. 47 ``` 48 49 This is a one time only code and the wormhole is only open for the duration of the transfer. 50 51 You can also send arbitrary text 52 ``` 53 wormhole send --text "hello friend" 54 ``` 55 56 The great thing about this tool is that you don't need any prior credentials or connection to the system like you would with SSH. It is also possible to run your own [Mailbox server](https://github.com/warner/magic-wormhole-mailbox-server/blob/master/docs/welcome.md) if you so desire. 57 58 Thanks to Brian Warner ([twitter](https://twitter.com/lotharrr)/[github](https://github.com/warner)) for Magic Wormhole.