<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Software on Sven Koschnicke</title><link>https://staging.sven.guru/tags/software/</link><description>Recent content in Software on Sven Koschnicke</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 07 May 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://staging.sven.guru/tags/software/index.xml" rel="self" type="application/rss+xml"/><item><title>Magic Wormhole</title><link>https://staging.sven.guru/posts/magic-wormhole/</link><pubDate>Wed, 07 May 2025 00:00:00 +0000</pubDate><guid>https://staging.sven.guru/posts/magic-wormhole/</guid><description>&lt;p&gt;In a world where software gets more and more complex, and because of that also bloated, there are sometimes little gems which make your day a little bit better. They adhere to the initial goal of software and computers, helping people to get their tasks done. And when they just do their job and then get out of the way, it sometimes makes me smile.&lt;/p&gt;
&lt;p&gt;One if these programs I just had the pleasure to use again is Magic Wormhole. A small command line utility which lets you transfer files between two computers.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://staging.sven.guru/ox-hugo/2025-05-07_16-41-33_screenshot.7917851ed96f0899d6b7b8aa9170e81ece838e3a538aef01a0783cf3a05b5509.png" alt="Terminal showing Magic Wormhole sending a file and printing a short human-readable wormhole code"&gt;
&lt;a href="https://xkcd.com/949/"&gt;XKCD &amp;ldquo;File transfer&amp;rdquo;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;So I wanted to give my laptop SSH access to a server I already had access to from my desktop computer. Of course, login through password is deactivated on the server. So I had to add the public SSH key of my laptop to the &lt;code&gt;authorized_keys&lt;/code&gt; file on the server.&lt;/p&gt;
&lt;p&gt;I could have sent my public key to myself by email or even put it on an USB stick and get it onto the desktop computer like this and then copy it to the server (using the very handy &lt;code&gt;ssh-copy-id&lt;/code&gt; program), but I remembered Magic Wormhole, which would let me transfer the key more easily to my desktop computer.&lt;/p&gt;
&lt;p&gt;I had it already installed, but it should be easy to install on almost any system (don&amp;rsquo;t ask me about Windows, though). Trying to remember how to use it, I entered &lt;code&gt;wormhole --help&lt;/code&gt; (actually I first tried &lt;code&gt;wormhole -h&lt;/code&gt;, but that doesn&amp;rsquo;t work):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ wormhole --help
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Usage: wormhole [OPTIONS] COMMAND [ARGS]...
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Create a Magic Wormhole and communicate through it.
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Wormholes are created by speaking the same magic CODE in two different
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; places at the same time. Wormholes are secure against anyone who doesn&amp;#39;t
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; use the same code.
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Options:
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --appid APPID appid to use
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --relay-url URL rendezvous relay to use
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --transit-helper tcp:HOST:PORT transit relay to use
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --dump-timing FILE.json (debug) write timing data to file
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --version Show the version and exit.
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --help Show this message and exit.
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Commands:
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; help
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; receive Receive a text message, file, or directory (from &amp;#39;wormhole send&amp;#39;)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; send Send a text message, file, or directory
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; ssh Facilitate sending/receiving SSH public keys
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Okay, so executing &lt;code&gt;wormhole send .ssh/id_ed25519.pub&lt;/code&gt; should give me a code-word which I can use on the receiving machine by executing &lt;code&gt;wormhole receive&lt;/code&gt; and get the file securely transferred.&lt;/p&gt;
&lt;p&gt;But then the &lt;code&gt;ssh&lt;/code&gt; command caught my attention, as it seemed to be exactly my use-case:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ wormhole ssh --help
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Usage: wormhole ssh [OPTIONS] COMMAND [ARGS]...
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Facilitate sending/receiving SSH public keys
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Options:
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --help Show this message and exit.
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Commands:
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; accept Send your SSH public-key
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; invite Add a public-key to a ~/.ssh/authorized_keys file
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That was perfect. Just executing &lt;code&gt;wormhole ssh invite&lt;/code&gt; on the server:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ wormhole ssh invite
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Now tell the other user to run:
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;wormhole ssh accept 1-embezzle-printer
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And then running &lt;code&gt;wormhole ssh accept 1-embezzle-printer&lt;/code&gt; on the laptop:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ wormhole ssh accept 1-embezzle-printer
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Sending public key type=&amp;#39;ssh-ed25519&amp;#39; keyid=&amp;#39;wayreth ssh key&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Really send public key &amp;#39;wayreth ssh key&amp;#39; ? [y/N]: y
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Key sent.
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And on the server the program exits with:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Appended key type=&amp;#39;ssh-ed25519&amp;#39; id=&amp;#39;wayreth&amp;#39; to &amp;#39;/home/sven/.ssh/authorized_keys&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That&amp;rsquo;s it. Now I could access the server from my laptop. Easy, secure, straight forward.&lt;/p&gt;</description></item></channel></rss>