<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Iruwen on Medium]]></title>
        <description><![CDATA[Stories by Iruwen on Medium]]></description>
        <link>https://medium.com/@iruwen?source=rss-184ea4e839cf------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*WSM7ewu5mSc7xpv_aEkHIA.png</url>
            <title>Stories by Iruwen on Medium</title>
            <link>https://medium.com/@iruwen?source=rss-184ea4e839cf------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 11:37:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@iruwen/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Changing WireGuard Interface Metric]]></title>
            <link>https://iruwen.medium.com/changing-wireguard-interface-metric-b1b1bca47d?source=rss-184ea4e839cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/b1b1bca47d</guid>
            <category><![CDATA[metrics]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[wireguard]]></category>
            <dc:creator><![CDATA[Iruwen]]></dc:creator>
            <pubDate>Fri, 29 Apr 2022 14:08:14 GMT</pubDate>
            <atom:updated>2022-04-29T14:20:14.317Z</atom:updated>
            <content:encoded><![CDATA[<p>Sometimes you’ll run into situations where it’s preferable or necessary to change a WireGuard interface’s metric, which defines the priority with which packets will be routed through it. WireGuard is kind of “greedy” by default and sets its interfaces to an extremely low metric, which means high priority, which means traffic will be processed by WireGuard first. This makes total sense in many cases, but sometimes not so much, especially with an increasing amount of interfaces and possible routes.</p><p>I assume you ended up here because you were specifically looking for this solution. If you don’t know why you should need it, you don’t and can stop reading now :-)</p><p>On Windows, changing interface metrics is daily business for network administrators. Unfortunately, this isn’t a straightforward task when using WireGuard, because the corresponding TUN interface is removed when a tunnel is deactivated, thus losing the setting. Here’s one way to do it properly and in a persistent way:</p><p>First you’ll have to allow the execution of additional commands when a tunnel is brought up. As documented <a href="https://git.zx2c4.com/wireguard-windows/about/docs/adminregistry.md">here</a>, this requires a registry key to be set. The command reg add HKLM\Software\WireGuard /v DangerousScriptExecution /t REG_DWORD /d 1 /f does just that (single line command, press Windows key + X to open a prompt with admin permissions). It creates a DWORD key with value 1 under the path HKEY_LOCAL_MACHINE\SOFTWARE\WireGuard .</p><p>Please note that allowing this is, as mentioned in the documentation, a security risk, simply because WireGuard runs with very elevated permissions. It’s not dangerous per se, but if you for example decide to run a script which anyone can edit, someone (say: malware) could put all kinds of dangerous commands into it. So please don’t just copy &amp; paste stuff without understanding it. Actually, that’s the official reason this additional registry step exists as I gathered from the mailing list — the assumption that Windows users are a bit dumb and will do just that, copy and paste random stuff. Which is probably true, to be honest.</p><p>Anyway, open the WireGuard GUI and edit your tunnel (or create a new one) now. The command we need goes in the [Interface] section:</p><pre>[Interface]<br>PrivateKey = ...<br>Address = ...<br>PostUp = powershell.exe -command &quot;Set-NetIPInterface -InterfaceAlias &#39;%WIREGUARD_TUNNEL_NAME%&#39; -InterfaceMetric 5000&quot;</pre><p>It’s simply invoking Windows <a href="https://docs.microsoft.com/en-us/powershell/">PowerShell</a> to run the <a href="https://docs.microsoft.com/en-us/powershell/module/nettcpip/set-netipinterface">Set-NetIPInterface</a> command with the right interface name and desired metric. Obviously, WireGuard knows what your tunnel and thus interface is called, so it can provide the name through the WIREGUARD_TUNNEL_NAME environment variable.</p><p>If you activate the tunnel now and check the output of the command route print in a prompt, you should see that the metrics for different routes have changed accordingly.</p><p>You’re welcome.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b1b1bca47d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to run a VPS on Hetzner and manage it remotely using Termius]]></title>
            <link>https://iruwen.medium.com/how-to-run-a-vps-on-hetzner-and-manage-it-remotely-using-termius-2a78938fd102?source=rss-184ea4e839cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a78938fd102</guid>
            <category><![CDATA[hetzner]]></category>
            <category><![CDATA[termius]]></category>
            <dc:creator><![CDATA[Iruwen]]></dc:creator>
            <pubDate>Wed, 10 Jul 2019 13:52:22 GMT</pubDate>
            <atom:updated>2020-04-29T10:24:09.549Z</atom:updated>
            <content:encoded><![CDATA[<p>Run your own private Linux server and manage it from your smartphone.</p><p>Several people asked me to write a guide about <a href="https://www.hetzner.com/cloud">Hetzner</a> as an alternative to platforms like Amazon and <a href="https://medium.com/@iruwen/running-a-free-vps-on-google-cloud-6deb9ac9a9e5">Google</a>, because it’s relatively inexpensive but very reliable. I decided to include <a href="https://termius.com/">Termius</a> here instead of conventional SSH clients like PuTTY which I already covered extensively in my <a href="https://medium.com/@iruwen/access-your-linux-system-using-ssh-49ac94ce1a42">SSH guide</a>, because it is a good modern mobile alternative to the powerful but dated established desktop clients. It’s available for all major desktop and mobile platforms (with a clear focus on mobile) and free to use in the <a href="https://termius.com/pricing">basic version</a>. Even if you decide not to use Hetzner, the process of getting SSH access is very similar for all providers, so you can still take this guide as an example.</p><p>I’m writing this article in the context of my <a href="https://medium.com/@iruwen/running-a-fusion-node-on-linux-part-1-21d44e73972c">Fusion guide</a>, but of course you can do whatever you want with your system, just adapt the settings according to your needs.</p><p>If you’re looking for an alternative to Hetzner, you can also check out my <a href="https://medium.com/@iruwen/running-a-free-vps-on-google-cloud-6deb9ac9a9e5">Google guide</a>.</p><p>Hetzner Online GmbH is an ISO 27001 certified and many times <a href="https://en.wikipedia.org/wiki/Hetzner#Awards">awarded</a> datacenter operator and hosting provider in Germany with many years of experience, offering a wide range of services. My company heavily utilizes most of these, and Hetzner has proven to be a reliable partner over the years.</p><p>To get access to their platform, please <a href="https://accounts.hetzner.com/signUp">register</a> first. Make sure you choose a hard to guess, long password with several special characters (I’m using <a href="https://keepass.info/">KeePass</a> and automatically generated 16 character passwords), because anyone who gets access to your account also has access to your server!</p><p>Hetzner doesn’t like anonymous registrations, so use a valid email address (they’ll send you a confirmation link) and your actual personal data. After you completed the registration, you can login to the <a href="https://console.hetzner.cloud/">Cloud Console</a>. Depending on the data you provided during registration, you might see this notification as you want to start using the console:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/1*O1w8cq9uaiE-J8Cw8ik17A.png" /></figure><p>In this case, please do as requested and go to <a href="https://accounts.hetzner.com/account/verification">Account Verification</a>. You can either provide a valid passport or make an up front payment to verify that you’re a legitimate user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*0MB6wjDiGgiDjO2cKljcow.png" /></figure><p>After you’ve done so, please also enable <a href="https://accounts.hetzner.com/tfa">Two-factor Authentication</a>. No matter how good your password is, you still might lose it and you <strong>really</strong> don’t want anyone to gain access to your account!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*55CPnnoJ968VGi8Ov5Pz7g.png" /></figure><p>After you entered your account password once again, you’ll be given a separate recovery login and key in case you ever need to reset your 2FA info, for example because you lost your smartphone. Keep this info in a safe place, which means not on your computer, or at least heavily encrypted. In case you lose this info as well, for example because your house burns down, Hetzner will send you a letter to the address you registered with (which is kind of unfortunate if your house burns down; just avoid that okay).</p><p>You can then setup a Yubikey or authenticator app like you’ve probably done before in your life, especially when you’re dealing with crypto. Yubikeys are quite expensive, so you’ll most likely use a smartphone app like <a href="https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2">Google Authenticator</a> or <a href="https://play.google.com/store/apps/details?id=com.authy.authy">Authy</a>. Just scan the QR code, enter your account password again, enter the one-time password (OTP) you see on your device and that’s it. You’ll need an OTP in the future everytime you login to the Cloud Console.</p><p>While you’re waiting to be verified by Hetzner, you can already install <a href="https://termius.com/">Termius</a> on your smartphone. It’s available for both <a href="https://play.google.com/store/apps/details?id=com.server.auditor.ssh.client">Android</a> and <a href="https://apps.apple.com/us/app/termius-ssh-shell-console-terminal/id549039908">iOS</a>. Personally I’m using Android (because it’s Linux, kind of) but I assume it looks similar on iOS for a consistent user experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KpsuZIBVGsABtriIqdrZiw.png" /></figure><p>You just want to use the basic version and don’t create an account (at least for now, if you like the app please support the developer!), so touch the left arrow at the top and then <em>continue without account</em>. Then open the main menu, select <em>keychain</em> and touch the <strong>+</strong> button to add a new SSH key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8UFKT6nAJbBBNjWJI8qi0w.png" /></figure><p>Enter a <em>name</em> and optionally select a different key <em>type</em> and <em>size</em> if you want. I’m using 4096 bit RSA here but it hardly matters, there’s no insecure option. Also enter an optional <em>passphrase</em> to protect the key, which you can <em>save</em> for convenience. You generally want the key to be protected (for example when you export it to a file later), but maybe don’t want to enter it everytime you’re using the app. In this case I highly recommend also enabling <em>PIN lock</em> in the app’s general settings though (the paid version also supports fingerprints).</p><p>After you touch the checkmark icon, the actual key generation starts, which takes a few moments. You’ll then be back in the keychain menu, where the newly added key should appear. At this point, you have several different options to achieve what comes next: getting your public key and adding it to your Hetzner account.</p><p>To get the public key, you can</p><ul><li>touch the key in the keychain menu, scroll down to the p<em>ublic key</em> section, select all and copy</li><li>touch the key in the keychain menu and select <em>export to file</em> or <em>send by email</em> from the three dot menu</li><li>touch <em>and hold</em> the key in the keychain menu and select <em>export to file</em> or <em>send by email</em> from the three dot menu</li></ul><p>The public key will be exported to a file called <em>Key.pub</em>. Its format depends on the <em>key type</em> you selected earlier. Use any method you want to transfer it to your computer, pasting it to Gmail or Evernote would be fine too for example, it’s a public key after all. Alternatively you can also open the <a href="https://console.hetzner.cloud/">Cloud Console</a> with your smartphone browser.</p><p>Maybe Hetzner already verified your account by now, then you can move on without a delay. Open the <a href="https://console.hetzner.cloud/">Cloud Console</a> again and create an new unique <em>project</em>. A project can contain multiple <em>servers</em>, <em>volumes</em>, <em>networks</em>, <em>user access</em> definitions and other stuff which you want to be logically separated from other projects. Note that there are limits to the resources you can use by default, which you can see under the corresponding menu item in the user menu on the top right. You have to write a formal request to increase these limits if you really need to.</p><p>After you created a new project, select <em>access</em> from the lefthand menu and then click <em>add SSH key</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/1*FL3dJc6VufmnmwvFOLKGoQ.png" /></figure><p>Paste the public key you just extracted from Termius by using the method of your choice into the corresponding text field and give it a unique <em>name</em>. The name would normally be taken from the public key’s comment field if it had one, but Termius doesn’t add that. Click <em>add SSH key</em> again to save the new key under its given name.</p><p>Now select <em>servers</em> from the lefthand menu in the Cloud Console and click <em>add server</em> to start the actual server setup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NFqrxBxOG8z_OIiFbtNtuA.png" /></figure><p>Here you have to select a datacenter <em>location</em> first. Hetzner currently has two locations in Germany, as well as one in Finland. I usually choose Finland just because I like the country and its people.<br>Also select an operating system <em>image</em> of your choice, where <em>Ubuntu 18.04 LTS</em> is the default.<br>The server <em>type</em> determines its number of vCPUs, the amount of memory and available storage. You can still add a <em>volume</em> in the next step or anytime later to extend it, so don’t focus on that too much.</p><p>Note that if you want to run a Fusion node, a CX21 with 2 vCPUs and 4GB of memory would generally be sufficient, but you’ll eventually run into storage issues sooner or later. As of July 2019, the whole system and chaindata utilize less than 5GB, but that’ll grow quicker with increased network usage. So either choose a CX31 from the start, or go with a CX21 and add a separate volume, the size of which you can increase on demand (even without stopping the system). This requires additional configuration though.</p><p>You can also choose between <em>local</em> and <em>network</em> storage. Local storage is super fast, while network storage is super resilient. By using network storage, in case of a local hardware failure, the server can just be restarted elsewhere. With local storage, you can also get <em>dedicated vCPUs</em>, meaning actual physical CPU cores which are reserved for you alone, unlike the shared cores you normally get. This can improve performance under heavy load or with time-critical applications.<br>I already mentioned the <em>volumes</em> you can add, which consist of fast SSD storage with up to 10TB capacity (you’ll have to write a request that you want to raise your limits first though).<br>A <em>network</em> allows you to connect multiple servers in a local private network (like a LAN) instead of just using their public external IP addresses.<br>The <em>user data</em> option allows you to customize your server on initialization by invoking a set of scripts and utilities called <a href="https://cloudinit.readthedocs.io/en/latest/">cloud-init</a>.<br>You can also enable <em>backups</em> for your server; by default you’ll lose your data in case of a critical failure, especially when you’re using local storage.<br>The <em>SSH key</em> option is <strong>important</strong>, please select the key you added earlier here or you won’t be able to access the server via SSH!<br>Finally give the server some unique <em>name</em>.</p><p>You can create multiple servers at once, unless you’d exceed the limits mentioned earlier by doing so. They’ll automatically be named by adding an incrementing number. During the whole process, you can transparently see the current total price of your selections.</p><p>Click <em>create &amp; buy now</em> to create and start the configured server(s). This will take a few moments.</p><p>You can find a lot more information about cloud servers in Hetzner’s <a href="https://wiki.hetzner.de/index.php/CloudServer/en">wiki</a>.</p><p>You’ll now see the name of the newly created server in the list. You can copy its IP address just by clicking on it. Write it down or just remember it, you’ll need it soon to configure Termius. In the three dot menu you’ll see a few more options, including shutting down the server or launching a simple browser based <em>console</em> which you can use to access it if SSH doesn’t work (for example because you misconfigured your SSH keys or the system’s firewall).</p><p>If you click the on your server in the list, you can access additional details and statistics and many more options.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*na4WkViqAbHOa_cZchSNig.png" /></figure><p>I won’t explain all of it in full detail here, most of it should be self-explanatory. What I really like about Hetzner besides its pricing and reliability is how easy it is to change and extend the server setup retroactively by adding new features, much of it even while the system is running.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k8eKHmOl4U5W2bO84K07Gw.png" /></figure><p>Note the <em>ISO images</em> menu, from which you have access to way more operating system images than during the initial setup, including Windows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Up3Mu4np1Sl-W2p8aGaHjQ.png" /></figure><p>Via the <em>rescue</em> menu, you can <em>reset</em> the server’s <em>root password</em>, which you can then use to login as root using the browser based console. You can also boot a <em>rescue system</em> from here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*FqwnCuzp7jCdvqRl2Jpaiw.png" /></figure><p>The <em>rescale</em> menu allows you to change the number of vCPUs and amount of memory available to the system. By default, the <em>disk size</em> isn’t changed, which allows you to downgrade again later. Note that if you choose to change the disk size as well, you still have to extend the filesystem of your server manually while it’s running, for example by running <em>resize2fs</em> under Linux.</p><p>Back in Termius, open the main menu, select <em>hosts</em> and touch the <strong>+</strong> button to add a new host.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gL-bp-3vAFzsxRmobWVsDA.png" /></figure><p>Enter an <em>alias</em> (name) for the new host and the <em>IP address</em> you noted earlier (if you didn’t you can just look it up again in the <a href="https://console.hetzner.cloud/">Cloud Console</a>). Scroll down a bit and enter <em>root</em> as your <em>username</em> (Hetzner doesn’t create an unprivileged user by default but just lets you login as root), then select the <em>SSH key</em> you generated ealier. After you touch the checkmark icon, the new host will be added.</p><p>You can now just touch the host in the list and start an SSH connection to your server. On the first connection attempt you’ll be asked to confirm the host key’s <em>fingerprint</em> as an additional security measure to make sure you connect to the right system.</p><p>If you work with many hosts in Termius, you might want to add an <em>Identity</em>. An identity is a preconfigured set of username, password and key which you can select during host setup instead of assigning this info to each host individually. That way, if you ever have to change your key for example, you only have to do so in one place.</p><p>A final note about Hetzner: they also offer a powerful <a href="https://docs.hetzner.cloud/">API</a> and an open source command-line client (CLI) called <a href="https://github.com/hetznercloud/cli">hcloud</a> which utilizes that API to manage servers aside from the Cloud Console webinterface, so you can fully automate the management of your cloud servers. There’s also an app called <em>My Hetzner</em> in the iOS and Android app stores, but since that is not an official app I can’t really recommend it, you have to try it for yourself if you think you can trust the developer.<br>To use any of these features, you have to create an <em>API token</em> in the <em>access</em> menu of the Cloud Console, which serves as authentication data for your project’s management API. You can create individual tokens for all of your different use cases.</p><p>Note that if you actually wanted to run a Fusion node, the next and final step would be to execute the following command to complete the setup:</p><pre>bash -c &quot;$(curl -fsSL https://raw.githubusercontent.com/FUSIONFoundation/efsn/master/QuickNodeSetup/fsnNode.sh)&quot;</pre><p>Also see my <a href="https://medium.com/@iruwen/running-a-fusion-node-on-linux-part-1-21d44e73972c">full guide</a> or the <a href="https://medium.com/@fusionprotocol/how-to-set-up-a-fusion-node-part-4b-ssh-into-your-vps-and-connect-your-node-to-the-fusion-93b55f6c14de">official guide</a> (from step 4).</p><p>If you need additional help, please join the official Telegram groups:<br><a href="https://t.me/FUSIONFoundation">https://t.me/FUSIONFoundation</a> for general Fusion discussions<br><a href="https://t.me/FsnDevCommunity">https://t.me/FsnDevCommunity</a> for development and node info</p><p>Also follow these announcement channels for updates:<br><a href="https://t.me/fusionannouncements">https://t.me/fusionannouncements</a><br><a href="https://t.me/fusiondevelopersannouncement">https://t.me/fusiondevelopersannouncement</a></p><p>If you think this article was helpful in any way, feel free to buy me a beer!</p><p>FSN: 0x0afAB9b6dA9FBb79f3260F71E4a17d4AF9AC1020<br>ETH: 0x0afAB9b6dA9FBb79f3260F71E4a17d4AF9AC1020<br>BTC: 16yAtsdjzEaQbH8ucK1nbtkqrpo791EZ7a</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a78938fd102" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Running a free VPS on Google Cloud]]></title>
            <link>https://iruwen.medium.com/running-a-free-vps-on-google-cloud-6deb9ac9a9e5?source=rss-184ea4e839cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/6deb9ac9a9e5</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <dc:creator><![CDATA[Iruwen]]></dc:creator>
            <pubDate>Thu, 27 Jun 2019 13:19:14 GMT</pubDate>
            <atom:updated>2020-04-29T10:24:21.170Z</atom:updated>
            <content:encoded><![CDATA[<p>Need a Linux server? Here’s how to get started with Google Compute Engine.</p><p>Google Cloud Platform <em>is a suite of cloud computing services that runs on the same infrastructure that Google uses internally for its end-user products, such as Google Search and YouTube. Alongside a set of management tools, it provides a series of modular cloud services including computing, data storage, data analytics and machine learning</em> (<a href="https://en.wikipedia.org/wiki/Google_Cloud_Platform">Wikipedia</a>).</p><p>Google Compute Engine is what you probably know as a virtual private server (VPS). You get a virtual machine (VM) with a freely usable operating system, in this case Ubuntu Linux. What’s really great about it is that after registration with a normal Google account, you get credits worth $300 to try out the platform for 12 months if you enter your credit card details. Just go to their <a href="https://console.cloud.google.com/">Console</a>, accept the terms of service and activate the free trial. You’ll never be charged unless you explicity order any paid services after you’ve run out of free credits! Google only needs the CC info to make sure you don’t create new accounts over and over.</p><p>I’m writing this article in the context of my <a href="https://medium.com/@iruwen/running-a-fusion-node-on-linux-part-1-21d44e73972c">Fusion</a> guide, so I’ll use the staking node setup as an example here, but of course you can do whatever you want with your system, just adapt the settings according to your needs.</p><p>If you’re looking for an alternative to Google, you can also check out my <a href="https://medium.com/@iruwen/how-to-run-a-vps-on-hetzner-and-manage-it-remotely-using-termius-2a78938fd102">Hetzner guide</a>.</p><p>After you registered, please select <em>Compute Engine</em> &gt; <em>VM Instances</em> in the left hand menu bar. The platform will be running some initialization tasks now, including setting up an initial project called <em>My First Project</em>, so you don’t have to take care of that. Projects allow you to keep different tasks entirely separate from each other. When the platform is finished, you can create your first VM by hitting the corresponding button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/835/1*qkX_UA_ryVP-KLvNYL7yng.png" /></figure><p>I already changed some settings here. I gave my VM a descriptive <em>Name</em> and chose a <em>Region</em>. Note that the region affects the costs, I didn’t dig through the docs but it’s probably based on usage and connectivity. Click <em>Details</em> on the right side to see a more detailed cost breakdown. You can also get discounts for sustained use, because that allows Google to optimize and plan its capacities in advance. I want to make my VM last as long as possible with my free credits, so I also clicked <em>Customize</em> in the <em>Machine type</em> section and chose 2 cores (vCPUs aren’t actual cores but compute slices on available physical cores, but let’s just say cores here) and 4GB of RAM, which isn’t available in the list of predefined types.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/456/1*7O_ZCIe09epuaJUAQvkK4Q.png" /></figure><p>Further down I changed my <em>Boot disk</em> <em>Image</em> to Ubuntu 18.04 LTS on 120GB of <em>standard persistent disk</em> storage. You can also choose <em>SSD storage</em>, which is of course faster but also more expensive. Note that Google encrypts all storage by default, so don’t worry that your data might crop up elsewhere long after you deleted your VM.</p><p>Finally open the section <em>Management, security, disks, networking, sole tenancy</em>.</p><p>You can leave most of the settings here at their defaults, but what you most likely want to do is paste your <em>SSH key</em> into the corresponding field on the <em>Security</em> tab, so you can access the system using SSH later. If you don’t know what that is or how to use it, please check out my extensive <a href="https://medium.com/@iruwen/access-your-linux-system-using-ssh-49ac94ce1a42">SSH guide</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/449/1*ZdqI_iEyDXjDkouF00U3qA.png" /></figure><p>Note that the username you’ll later use to login to your system is derived from the key comment and will be shown to the left (marked red here). If the comment contains an email address, only the part in front of the @ will be used.</p><p>If you need to execute only very few commands on the system and rarely ever touch it, you could theoretically also skip this and just use Google’s browser based SSH client (which works surprisingly well, see further below).</p><p>Now switch to the <em>Networking</em> tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/471/1*DbFmBX9jWXr8WCpr1O9mzw.png" /></figure><p>Here you need to change two things. First, add a <em>Network tag</em>. This will later be needed to apply firewall rules, so the system is accessible from its public external IP address. Speaking of which, VMs have ephemeral IP addresses by default, so after each reboot (or crash) you’d get a new one. For my use case, running a staking node, this is definitely not what I want, so I changed the <em>default interface</em>’s <em>external IP</em> setting accordingly by selecting the <em>Create IP address</em> option and assigning a name to it. I also chose the <em>Premium Network Service Tier</em> in the process, because I want the best available peerings on Google’s backbone for fast connectivity.</p><p>That’s it, you can now start the VM by clicking the <em>Create</em> button.</p><p>You generally may have to assign a lot of unique names within a project when working with Google’s platform, so if you plan to use it extensively it’s probably a good idea to think about a personal naming convention and some kind of scheme <em>before</em> you start with the deployment. If I wanted to run multiple Fusion nodes for example, it wouldn’t have been too smart to call this first one just <em>fusion</em>.</p><p>You should be redirected to your list of VMs after a few moments, where you’ll see the one you just created up and running along with its external IP address.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*Y9euKurasd8K3mGoL6l9vQ.png" /></figure><p>You can now access your VM from here, as well as doing basic stuff like stopping and starting it.</p><p>Please select <em>SSH</em> &gt; <em>Open in browser window</em> from the <em>Connect</em> column to see if you can actually connect to the system. This will take a moment while the platform sends your SSH key to the VM, then a browser based console window should open, presenting you with a shell prompt. It’s so advanced that you can even use the regular <a href="https://cloud.google.com/compute/docs/ssh-in-browser?hl=en#copypaste">copy and paste</a> hotkeys. You can see the user you’re logged in as at the beginning of the prompt, in the form <em>username@hostname</em>, or by typing the command <em>whoami</em>. Use the command <em>sudo -s</em> to become root.</p><p>If you want to connect using a third-party SSH client like PuTTY your username will differ, as it’s the one derived from your key comment as described further up. Use that username and the VM’s external IP address to establish a connection.</p><p>Looking back at the VM list now, please open the three dots menu on its right side and select <em>View network details</em>. Unlike other providers, Google doesn’t expose your system to the whole internet by default. Instead, only the ICMP protocol (used for example to ping a system), RDP (remote desktop) and SSH as well as network internal access are allowed by default, as can be seen here.</p><p>You want to add additional ports to this list, so please select <em>Firewall rules</em> from the menu to the left and then <em>Create Firewall Rule</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/1*Y58S8wc3zk2TdfS0bgmrTw.png" /></figure><p>I skipped the naming stuff at the top here, you already know how to handle that. Please make sure that <em>Ingress</em> is selected as the <em>Direction of traffic</em>, which means incoming traffic, and that <em>Action on match</em> is set to <em>Allow</em>. Both are the defaults though. Enter the <em>Network tag</em> you chose during the VM creation process earlier in the <em>Target tags</em> field. You probably want to make the ports available to everyone, so enter 0.0.0.0/0 as the <em>Source IP range</em>, which means every IPv4 address in existence. I want to allow external access to port 40408 for both TCP and UDP, so I entered this information accordingly.</p><p>You can now click the <em>Create</em> button and should be redirected to the list of default firewall rules, where you’ll see the newly created custom rule on top.</p><p>Congratulations, you have a free basic system running now. Depending on your requirements, the free credits should be sufficient to run a VM for some weeks or even months. Google’s pricing isn’t especially cheap, but it’s transparent and fair I guess and you get access to a super reliable, secure and versatile platform. Of course, if you like the services they offer, pay for them.</p><p>If you want to manage your VM from your smartphone, I can recommend <a href="https://termius.com/">Termius</a> (SSH only), or the official <a href="https://cloud.google.com/console-app/">Google Cloud Console</a> app, which is a lot more powerful but also more complex, you probably won’t need the other features. Both apps are available for iOS as well as Android.</p><p>Note that if you actually wanted to run a Fusion node, the next and final step would be to execute the following command to complete the setup:</p><pre>bash -c &quot;$(curl -fsSL https://raw.githubusercontent.com/FUSIONFoundation/efsn/master/QuickNodeSetup/fsnNode.sh)&quot;</pre><p>Also see my <a href="https://medium.com/@iruwen/running-a-fusion-node-on-linux-part-1-21d44e73972c">full guide</a> or the <a href="https://medium.com/@fusionprotocol/how-to-set-up-a-fusion-node-part-4b-ssh-into-your-vps-and-connect-your-node-to-the-fusion-93b55f6c14de">official guide</a> (from step 4).</p><p>If you need additional help, please join the official Telegram groups:<br><a href="https://t.me/FUSIONFoundation">https://t.me/FUSIONFoundation</a> for general Fusion discussions<br><a href="https://t.me/FsnDevCommunity">https://t.me/FsnDevCommunity</a> for development and node info</p><p>Also follow these announcement channels for updates:<br><a href="https://t.me/fusionannouncements">https://t.me/fusionannouncements</a><br><a href="https://t.me/fusiondevelopersannouncement">https://t.me/fusiondevelopersannouncement</a></p><p>If you think this article was helpful in any way, feel free to buy me a beer!</p><p>FSN: 0x0afAB9b6dA9FBb79f3260F71E4a17d4AF9AC1020<br>ETH: 0x0afAB9b6dA9FBb79f3260F71E4a17d4AF9AC1020<br>BTC: 16yAtsdjzEaQbH8ucK1nbtkqrpo791EZ7a</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6deb9ac9a9e5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Save fees by withdrawing tokens from IDEX using its “escape hatch”]]></title>
            <link>https://iruwen.medium.com/save-fees-by-withdrawing-tokens-from-idex-using-its-escape-hatch-5f13bf55f78b?source=rss-184ea4e839cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f13bf55f78b</guid>
            <category><![CDATA[idex]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Iruwen]]></dc:creator>
            <pubDate>Sun, 27 Jan 2019 20:39:39 GMT</pubDate>
            <atom:updated>2022-08-24T07:23:00.688Z</atom:updated>
            <content:encoded><![CDATA[<p>Want to withdraw small amounts from IDEX at a minimum fee? Here’s how.</p><p><strong>UPDATE 2020–10–20:</strong> After the launch of <a href="https://exchange.idex.io/">IDEX 2.0</a>, this guide is probably obsolete - I didn’t check how exactly the new version works as I’m not using it myself. The instructions can still be followed to access the legacy IDEX 1.0 contract and withdraw funds from it if necessary.</p><p><a href="https://idex.market/">IDEX</a> is a semi-decentralized non-custodial exchange, so while it’s not a “true DEX”, you’re always in control of your assets, which is what most users care about. Tokens are deposited to an immutable smart contract, which has a so called “escape hatch” that can be used to withdraw them even if the centralized website normally used to interact with the contract goes down.</p><p>You can exploit that to withdraw tokens at a minimum fee paid in ETH. Normally withdrawal fees are deducted from the token you’re withdrawing, and since IDEX wants its withdrawals to be processed quickly, they’re taking a <a href="https://idex.market/faq#gasprice">gas price</a> as a basis that is a lot higher than <a href="https://ethgasstation.info/">Eth Gas Station</a>’s “SafeLow” value. At the time of writing it was 4 Gwei vs 12 Gwei, but I’ve seen ratios up to 1:10.</p><p>The FAQ states that they “have a feature in the works that will allow users to lower the gas price of their withdrawals significantly”, but since that is not ready yet and the escape hatch is only mentioned briefly in their FAQ, I decided to write this guide on how to use it correctly.</p><p>There’s a constraint though: you have to wait until the so called “inactivity release period” is over to use this feature, meaning you’re not allowed to trade during that time. That period is 100,000 blocks, and at an average blocktime of 15 seconds that means 100000 / ((1 / 15) * 60 * 60 * 24) = ~17 days. Yeah, bummer.</p><p>If you prefer video guides, check out <a href="https://www.youtube.com/watch?v=e_xHTBXrruo">this one</a>!</p><p>First of all you have to know a) what you want to withdraw, and b) how much of it. The “what” shouldn’t be too hard, just visit <a href="http://etherscan.io/">Etherscan</a> and search for the token you want to withdraw. If you can’t find it, or if there are multiple results and you’re unsure which one is the right one, you can also look it up on <a href="https://coinmarketcap.com/">CoinMarketCap</a> and use the “Explorer” link, which should take you to the right token on Etherscan.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/358/1*iOn0uT2d4gaoyYkXz7PQxQ.png" /></figure><p>If you’re looking at <a href="https://coinmarketcap.com/currencies/etherparty/">this</a> token for example, that link will take you <a href="https://etherscan.io/token/0xea38eaa3c86c8f9b751533ba2e562deb9acded40">here</a>. You can be almost sure that it is the right token because it has a price and several links, including one to the official project site. You need the “Contract” address, which you’ll find in the upper right corner of the page (<em>0xea38eaa3c86c8f9b751533ba2e562deb9acded40</em> in this example). If you move the mouse over it, a small copy icon should appear. You’ll find these copy icons in many places in Etherscan, which makes your life a lot easier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*uTQUFObvZt1TKMzpKrmo9A.png" /></figure><p>We’ll come to the “how much to withdraw” part soon, but first you also need the IDEX contract address. You can search for “IDEX_1” on Etherscan, or visit <a href="https://idex.market/">IDEX</a> and go to HELP &gt; ETHERSCAN CONTRACT. The contract address is <a href="https://etherscan.io/address/0x2a0c0dbecc7e4d658f48e01e3fa353f44050c208"><em>0x2a0c0dbecc7e4d658f48e01e3fa353f44050c208</em></a> at the time of writing.</p><p>Go to <a href="https://etherscan.io/address/0x2a0c0dbecc7e4d658f48e01e3fa353f44050c208#readContract">Read Contract</a> on Etherscan. “<em>9. inactivityReleasePeriod</em>” shows you the current inactivity release period, which should be 100,000 blocks. You can check if you meet this requirement by entering your personal wallet address in “<em>1. lastActiveTransaction</em>” and clicking “<em>Query</em>”. The result should be lower than the <a href="https://etherscan.io/blocks">last block</a> minus 100,000.</p><p>Scroll down to “<em>11. balanceOf</em>”, insert the token contract address you figured out above into the “<em>token (address)</em>” field and your personal wallet address into the “<em>user (address)</em>” field. Click “<em>Query</em>” again and you’ll be presented with your IDEX balance below “<em>balanceOf method Response</em>” (in<em> </em>UINT256 format, which is just a specific way to format a number).</p><p><strong>Keep the page open</strong> or copy both the token contract address and amount elsewhere, you’ll need this information later!</p><p>From here on, there are two possible ways to move forward: by utilising <a href="https://mycrypto.com/">MyCrypto</a> to interact with the contract, or since a recent update you can also initiate the required transaction directly from <a href="https://etherscan.io/">Etherscan</a>, which is more convenient but still a beta feature. So far, it worked fine for me though.</p><p><strong>Variant 1:</strong> visit <a href="https://mycrypto.com/">MyCrypto</a>, the <a href="https://mycrypto.com/contracts/interact">Interact with Contracts</a> page to be precise. Insert the IDEX contract address (see above) into the “<em>Contract Address</em>” field, and the “Contract ABI”, which you can find in the second box on Etherscan’s contract <a href="https://etherscan.io/address/0x2a0c0dbecc7e4d658f48e01e3fa353f44050c208#code">Code</a> page, into the “<em>ABI / JSON Interface</em>” field.</p><p>Click “<em>Access</em>” and select “<em>withdraw</em>” (not “<em>withdraw</em><strong><em>n</em></strong>”, unfortunately that function also exists) from the “<em>Read / Write Contract</em>” drowdown list. Now copy the token contract address from “<em>token (address)</em>” on Etherscan to the corresponding “<em>token address</em>” field on MyCrypto, and your balance from “<em>balanceOf method Response</em>” on Etherscan to “<em>amount uint256</em>” on MyCrypto. I’m assuming that you want to withdraw your whole balance here, otherwise you’d have to modify the UINT256 value to reflect the right amount.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*POu4IxfvuQ1daQSWmlyxkQ.png" /></figure><p>Next access your wallet like you normally do (depending on what kind of wallet you’re using, e.g. MetaMask or Ledger). Don’t insert anything into the “<em>Value</em>” field, but set “<em>Gas Price (gwei)</em>” to some reasonable value; you have to decide what that means for yourself, but <a href="https://ethgasstation.info/">EthGasStation</a> will surely be of great help here. If you set it too low, the transaction will take forever and eventually drop out of the mempool in the end. If you set it too high, you could as well just withdraw directly from IDEX 😉 You can keep the “<em>Automatically Calculate Gas Limit</em>” checkbox enabled, MyCrypto usually gets this right.</p><p>Now click “<em>WRITE</em>”, then “<em>Generate Transaction</em>” and finally “<em>Send Transaction</em>”. You’ll get a final chance to check that everything is correct. Please do so and then send and sign the transaction. The exact process might differ slightly for other authentication methods than MetaMask here, which is what I’ve been using.</p><p><strong>Variant 2</strong>: visit Etherscan again, but this time go to <a href="https://etherscan.io/address/0x2a0c0dbecc7e4d658f48e01e3fa353f44050c208#writeContract">Write Contract</a>. Do this in a different tab, unless you copied the token contract address and amount we figured out on the “Read Contract” page earlier elsewhere. You should see a red dot and “<em>Write Contract Connect to Web3</em>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/221/1*FhcJ9kZ9tduFnf7C0kqSFw.png" /></figure><p>Click the link and establish the connection. I used MetaMask, not sure what else works here.</p><p>It has to be a Web3 provider which knows your IDEX wallet of course. If the connection was successful, the dot should have turned green. Etherscan will warn you that this is a beta feature, treat it as such. As I said before, it worked fine for me so far, but you never know.</p><p>Scroll down to “<em>14. withdraw</em>”, copy the token contract address from “<em>token (address)</em>” on the “Read Contract” page to the corresponding “<em>token (address)</em>” field here, and your balance from “<em>balanceOf method Response</em>” on the “Read Contract” page to “<em>amount (uint256)</em>” here. I’m assuming that you want to withdraw your whole balance, otherwise you’d have to modify the UINT256 value to reflect the right amount.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N4fkkOOODbfC6EZ3wvGxqw.png" /></figure><p>Now click “<em>Write</em>”, then you should get a final chance to check that everything is correct with whatever Web3 provider (wallet) you’re using. Please do so, especially make sure that you’re using a reasonable gas price for the transaction; you have to decide what that means for yourself, but <a href="https://ethgasstation.info/">EthGasStation</a> will surely be of great help here. If you set it too low, the transaction will take forever and eventually drop out of the mempool in the end. If you set it too high, you could as well just withdraw directly from IDEX 😉 Then send and sign the transaction.</p><p>After the transaction has been processed (included in a block), you should see the tokens in your personal wallet. Note that if you check your balances on IDEX now, you’ll probably see the same amount of tokens both in your personal wallet and on IDEX. Don’t cheer and try to withdraw again, this is just a display issue (eventually because IDEX keeps track of its balances in an off-chain database for performance reasons). The values will either be corrected automatically after some time, or will do so as you try to withdraw again using the interface.</p><p>Congratulations, you have withdrawn your tokens at the lowest possible fee!</p><p>Here’s a very short rundown of what you need for future reference:</p><pre><strong>Preparation</strong></pre><pre>1. IDEX Contract Methods (Read):<br><a href="https://etherscan.io/address/0x2a0c0dbecc7e4d658f48e01e3fa353f44050c208#readContract">https://etherscan.io/address/0x2a0c0dbecc7e4d658f48e01e3fa353f44050c208#readContract</a></pre><pre>2. Use &quot;balanceOf&quot; Method:<br>&gt; Insert the Token Contract Address<br>&gt; Insert your User Wallet Address</pre><pre>3. Check reasonable Gas Price on <a href="https://ethgasstation.info/">https://ethgasstation.info</a></pre><pre><strong>Variant 1 (MyCrypto)</strong></pre><pre>1. Interact with Contract:<br><a href="https://mycrypto.com/contracts/interact">https://mycrypto.com/contracts/interact</a></pre><pre>2. IDEX Contract Address:<br>0x2a0c0dbecc7e4d658f48e01e3fa353f44050c208</pre><pre>3. IDEX Contract ABI:<br><a href="https://etherscan.io/address/0x2a0c0dbecc7e4d658f48e01e3fa353f44050c208#code">https://etherscan.io/address/0x2a0c0dbecc7e4d658f48e01e3fa353f44050c208#code</a></pre><pre>4. Read / Write Contract:<br>&gt; Use &quot;withdraw&quot; Method<br>&gt; Insert the Token Contract Address<br>&gt; Insert the Token Amount (in UINT256)</pre><pre>5. Send Transaction with reasonable Gas Price</pre><pre><strong>Variant 2 (Etherscan)</strong></pre><pre>1. IDEX Contract Methods (Write):<br><a href="https://etherscan.io/address/0x2a0c0dbecc7e4d658f48e01e3fa353f44050c208#writeContract">https://etherscan.io/address/0x2a0c0dbecc7e4d658f48e01e3fa353f44050c208#writeContract</a></pre><pre>2. Connect to Web3 Provider</pre><pre>3. Use &quot;withdraw&quot; Method:<br>&gt; Insert the Token Contract Address<br>&gt; Insert the Token Amount (in UINT256)</pre><pre>4. Send Transaction with reasonable Gas Price</pre><p>My Telegram username is @Iruwen, you can find me in <a href="https://t.me/CoinMarketCap">CoinMarketCap</a>’s great international community where we discuss general crypto topics. I’ll gladly try to help you out with technical questions of all sorts.</p><p>If you think this was helpful in any way, feel free to buy me a beer!</p><p>ETH: 0x0afAB9b6dA9FBb79f3260F71E4a17d4AF9AC1020<br>BTC: 16yAtsdjzEaQbH8ucK1nbtkqrpo791EZ7a</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f13bf55f78b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Access your Linux system using SSH]]></title>
            <link>https://iruwen.medium.com/access-your-linux-system-using-ssh-49ac94ce1a42?source=rss-184ea4e839cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/49ac94ce1a42</guid>
            <category><![CDATA[ssh]]></category>
            <dc:creator><![CDATA[Iruwen]]></dc:creator>
            <pubDate>Wed, 16 Jan 2019 11:11:03 GMT</pubDate>
            <atom:updated>2019-09-27T09:12:34.900Z</atom:updated>
            <content:encoded><![CDATA[<p>Working on a server without SSH is a nightmare, so let’s set it up properly.</p><p>You really want SSH access when you’re working on a remote headless Linux system (meaning it has no desktop environment). I’ll use <a href="http://www.9bis.net/kitty/">KiTTY</a> here, which is a fork of <a href="https://www.putty.org/">PuTTY</a>, which is the quasi-standard for SSH clients. They look almost identical, so everything I describe here works for both. Since using shells and SSH is a native concept and thus quite easy on Linux and also Mac OS (because it has BSD roots), I’ll only mention them briefly here and focus on Windows.</p><p>I also wrote a separate guide on how to get started with a <a href="https://www.hetzner.com/cloud">Hetzner VPS</a> and <a href="https://termius.com/">Termius</a>, because the latter is a good modern mobile alternative to the powerful but dated established desktop clients. It’s available for all major desktop and mobile platforms (with a clear focus on mobile) and free to use in the <a href="https://termius.com/pricing">basic version</a>.</p><p>If you’re using a leased server and your provider offers to generate authentication keys for you, or you don’t want to use usernames and passwords and create those keys yourself, you can skip this part of the guide.</p><p>The most basic way to use SSH is by entering a combination of username and password. Your provider should have sent you the <em>IP address</em> of your system, as well as the <em>login information</em>. Enter the IP address in the <em>Host Name (or IP address)</em> field:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*euLoUAodREvatUHXa28zdw.png" /></figure><p>That’s all if your username is <em>root</em>. If it’s something different, navigate to <em>Connection &gt; Data</em> in the left menu and change the <em>Auto-login username</em> accordingly. If you leave it blank, you’ll be asked for it on connect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*XoCCDW_nWKzjn6yKU5W5Sg.png" /></figure><p>That’s it. You will be asked for the password; there is no way to save it here, as the developer considered that too much of a risk. If you want to save the changes you made, head back to the <em>Session</em> main dialog and enter a name for your session in the <em>Saved Sessions/New Folder</em> field, then click <em>Save</em>. If you leave the field blank, instead select <em>Default Settings</em> from the list and click <em>Save</em>, these will become the default settings which are automatically loaded when the client starts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*DulFyhGvGNFumPQG8OYOjg.png" /></figure><p>You can connect by clicking <em>Open</em> now.</p><p>Before I proceed with the more advanced (and secure) concept of public key authentication, I’ll show you how to upload files to your server, because that’ll be one of the methods you can use to setup your keys then.</p><p>If you’re using <a href="https://winscp.net/">WinSCP</a>, choose the <em>Commander</em> user interface when asked for it during installation. Then start it and you should be presented with a login dialog. You can use <em>SCP</em> or <em>SFTP</em> as <em>File protocol</em>, I prefer SFTP but it doesn’t really matter here (see <a href="https://winscp.net/eng/docs/protocols">this</a> comparison). Note that SFTP has nothing to do with the ancient insecure FTP protocol (and it’s more secure form FTPS) where you had to think about firewalls and passive/active modes.</p><p>Anyway, enter your IP address, username and password again and you’re good to go; it should be self-explanatory which goes where. You can even save your password here, as the developer decided that it’s your own choice if you want to do so.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*LT0NthBkhVk7P-5YMyqR2w.png" /></figure><p>If you’re using <a href="https://filezilla-project.org/">FileZilla</a>, you can enter your login information in the <em>Quickconnect</em> bar:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*zbnGL1xSnjol5Sb1wuEbjQ.png" /></figure><p>Note that you have to explicitly set the <em>Port</em> to <em>22</em>, or the program will try to use the legacy FTP protocol which won’t work (hopefully, better change your provider if it does).</p><p>You can also access the <em>Site Manager</em> from the <em>File</em> menu and save your data as a session for future use. Click <em>New Site</em> and enter a name for the session, then select the <em>SFTP Protocol.</em> There’s no need to specify a <em>Port</em> this time, as SFTP implies port 22 already. Choose <em>Logon Type</em> normal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*wpyd8xLCQXrtLqROnKGBXQ.png" /></figure><p>My session list is blank here as I already had some sessions in it, which I obliterated for obvious reasons.</p><p>You already know how to access the shell of your server using SSH now, as well as how to upload files using SFTP (or SCP). But you’re not doing it in a secure and comfortable way yet. So, let’s create a key pair!</p><p>I’ll skip instructions on how to do it using <em>ssh-keygen</em> on the console here, as that doesn’t require key conversion and is pretty straightforward. If you’re using Linux or a Mac and don’t know how to do it already, follow <a href="https://www.vultr.com/docs/generating-ssh-keys-on-macos-sierra-10-12-and-high-sierra-10-13">this guide</a>. It also covers the <em>ssh-copy-id</em> command, which puts the public key on your server.</p><p>If you’re using a leased server, some providers will offer to generate a key pair for you. If this is the case, you can skip the following two sections. The public key will usually be automatically provisioned to the system and you can simply use the provided private key to access it. This is fine; if he wanted to, your provider could get full access to your server anyway, so don’t worry about him possibly keeping a copy of your private key.</p><p>If you’re using Windows, download PuTTYgen <a href="https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html">here</a> (search for <em>puttygen.exe</em>), which is the <em>PuTTY Key Generator</em> tool, and start it. It’ll look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/479/1*ZbrinO_yArpqN4DhPKPDbw.png" /></figure><p>You could increase the <em>Number of bits in a generated key</em> now (or use a different key type altogether, eventually you’ve heard about <a href="https://en.wikipedia.org/wiki/Elliptic-curve_cryptography">elliptic-curve cryptography</a> already), but 2048 Bit RSA is really <a href="https://www.yubico.com/2015/02/big-debate-2048-4096-yubicos-stand/">strong enough</a> for the foreseeable future and the given use case.</p><p>After you click <em>Generate</em>, you’ll be asked to move around the mouse over the window for <em>randomness</em> (also called <a href="https://en.wikipedia.org/wiki/Entropy_(computing)">entropy</a>). You need some chaos to generate strong cryptographic keys, or they’d be too easy to guess. Your computer isn’t really good at creating chaos on its own, since all it can do is flip 0s and 1s really fast, so it needs your help here. After the key generation algorithm is done, you’ll see something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/479/1*NQ2OSU-RtXoBEjH32NdQPg.png" /></figure><p>You can change the <em>Key comment</em> to something more recognizable if you want to, that makes it easier to know which key is for what later on. You can put your username or email address there, or something completely different.</p><p>Select everything in the upper field which is captioned <em>Public key for pasting into OpenSSH authorized_keys file</em> (<em>right click &gt; Select All</em>), press <em>Ctrl + c </em>to copy it and then paste it to a file called <em>authorized_keys</em>, as the description says. Simply use a text editor of your choice (like <a href="https://notepad-plus-plus.org/">notepad++</a>). It should end up as a <em>single line without breaks</em>, starting with <em>ssh-rsa</em> and ending with your <em>Key comment</em>. Do <strong>not</strong> use the <em>File &gt; Save public key</em> option, as that’ll save the key in a different format you won’t be able to use!</p><p>You have saved the <em>public</em> key now, but you still need the matching <em>private</em> key.</p><p>If you enter a <em>Key passphrase</em>, your private key will be encrypted. That’s an additional line of defense in case someone gets access to your key file. If you don’t set a passphrase, everyone who has the file can gain full access to your system. Not setting a passphrase is more comfortable, but very insecure of course. I’ll show you a way to have <em>both security and comfort</em> further down, so the preferable method is to set a passphrase here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/479/1*-5CI7tyQDMWZn0QCUbDa3A.png" /></figure><p>Click <em>Save private key</em> and choose a safe place, especially if you didn’t set a strong passphrase. So please don’t put it in your Dropbox or Evernote.</p><p>You created both a public and private key now, so you can close PuTTYgen.</p><p>The next step is to put the public key on your server. If you’re using a leased server, your provider should offer an option to save your public key in the management interface, which will then be provisioned to every new instance you create. Usually you have to paste it somewhere. This is what it looks like for <a href="https://my.vultr.com/sshkeys/">Vultr</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t9hgn83mHnzKs4X6FJ7kcQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NsbydlKYewPTJf4gSD-O8g.png" /></figure><p>If you already have a running instance, or your provider doesn’t offer that function, you have to copy the key manually.</p><p>When you login via SSH using public key authentication, the server checks if the following file exists and contains your public key:</p><pre>~/.ssh/authorized_keys</pre><p><em>~</em> is your home directory on Linux. If you login as root, it’s <em>/root</em>. If you login as some other user, it’s usually <em>/home/&lt;user&gt;</em>.<em><br>.ssh</em> is a hidden directory because it starts with a dot, meaning it’s usually not shown in directory listings by default. This also works for files, it’s pretty much the same as the hidden files and folders function on Windows.<br><em>authorized_keys</em> contains the public keys authorized to access the system for the given user, meaning the one that the home directory it’s located in belongs to, one per line.</p><p>You have two main options here, both of which involve logging into the system using one of the methods described in the previous sections.</p><p><strong>a)</strong> upload the <em>authorized_keys</em> file you saved during the key generation process using one of the graphical tools you already used earlier. I’m using WinSCP in this example, it works almost identically with FileZilla though.</p><p>Make sure you’re in your home directory after logging in. If you don’t see a <em>.ssh</em> subdirectory there, create it via <em>right click &gt; New &gt; Directory</em>. Enable the <em>Set permissions</em> checkbox and make sure they’re <em>0700</em>, meaning only the current user can access it. It should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/339/1*FvP5hKlIe-diTPdmgD5XMA.png" /></figure><p>Now enter the <em>.ssh</em> directory and upload your <em>authorized_keys</em> file to it. If you can’t figure out how to do that because you don’t see your local folder structure on the left side of the window, navigate to <em>Options &gt; Preferences &gt; Environment &gt; Interface</em> and select the <em>Commander</em> user interface. After restarting WinSCP, it should be obvious.</p><p>Make sure the uploaded file has the correct permissions by right clicking it and viewing its <em>Properties</em>. The permissions should be <em>0600</em> in this case:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/359/1*-ul2XWdRorFBFhypW4ZamQ.png" /></figure><p><strong>b)</strong> you can also create or modify the <em>authorized_keys</em> file from the shell. Login using KiTTY or PuTTY first, then execute the following command to create the <em>.ssh</em> directory with the right permissions, so only you have access to it. If it’s already there, nothing will happen, so it doesn’t do harm in any case:</p><pre>mkdir -p -m 0700 ~/.ssh</pre><p>There’s a plethora of ways to create or modify the <em>authorized_keys</em> file now, I’ll go with the most user friendly approach here and use a simple text editor.</p><pre>nano ~/.ssh/authorized_keys</pre><p>If you get a <em>command not found</em> error, install <em>nano</em> using the system package manager first. On Ubuntu or Debian, that’s as easy as <em>apt-get install nano</em>.</p><p>You should see an empty new file now, unless it already existed and contains some public key(s). Go to the beginning of the first blank line using the cursor keys if it’s not empty, then paste the public key from your <em>local authorized_keys</em> file. To do so, open it with a text editor like <a href="https://notepad-plus-plus.org/">notepad++</a>, select the single line it should contain, press <em>Ctrl + c</em> to copy it, and then paste it remotely by <em>right clicking on the console window</em>, as <em>Ctrl + v</em> won’t work here.</p><p>Now save the file by pressing <em>Ctrl + x</em> and then <em>Enter</em>. Make sure its permissions are correct:</p><pre>chmod 0600 ~/.ssh/authorized_keys</pre><p>If you’re using Linux or Mac OS, the process is simpler. Please take a look at the end of <a href="https://www.vultr.com/docs/generating-ssh-keys-on-macos-sierra-10-12-and-high-sierra-10-13">this guide</a> for instructions on how to use the <em>ssh-copy-id</em> command.</p><p>That was the complicated part. You can now finally use your private key to access the system. I’m adding an intermediate step here, which you can skip if you want the <em>real deal</em> when it comes to authentication. This is only the simplest way to use your keys.</p><p><strong>a)</strong> if you’re using KiTTY or PuTTY, navigate to <em>Connection &gt; SSH &gt; Auth</em> in the left menu and select your key file in the <em>Private key file for authentication</em> field.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*bi_VCDh2YSZAv5bvzM5bJQ.png" /></figure><p><strong>b)</strong> if you’re using WinSCP, go to the <em>Advanced</em> menu in the login dialog, navigate to <em>SSH &gt; Authentication</em> and select your key file in the <em>Private key file</em> field.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*E8N9_QfhP45WvW1dAjMv2g.png" /></figure><p><strong>c)</strong> if you’re using FileZilla, go to the <em>Site Manager</em> and change <em>Logon Type</em> to <em>Key file</em>, then select your key file in the <em>Key file</em> field.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*yIgtotiifJWXfVAEEnqODQ.png" /></figure><p>Alternatively you can open the <em>Settings</em> from the <em>Edit</em> menu, navigate to <em>Connection &gt; SFTP</em> and add your key file there.</p><p>No matter which client you use, always remember to properly save your sessions, or you have to change that setting each time.</p><p>If you protected the private key with a passphrase, you’ll be asked for it when you establish a connection. Otherwise you’ll login instantly.</p><p>Further up I said you can have both security and comfort, so let’s go one step further and use an <em>authentication agent</em>. You can use either <a href="http://www.9bis.net/kitty/?page=Download">KiTTY agent</a> (<em>kageant.exe</em>) or <a href="https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html">PuTTY agent</a> (<em>pageant.exe</em>).</p><p>After you downloaded and started one of the agents, it’ll sit in your system tray (the area next to the clock in the taskbar). Watch out for this icon:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/88/1*7OisXEMrrDk5d3pkqV38zg.png" /></figure><p>Right click it, select <em>Add Key</em> from the menu and load your private key file. If you protected the private key with a passphrase, you’ll now be asked for it.</p><p>That’s it, you have an authentication agent up and running!</p><p>…so what? Well, for one you don’t have to enter your passphrase on every consequent login attempt. Every client that supports agent authentication will use the already decrypted private key the agent provides, unless that feature isn’t enabled of course.</p><p>For KiTTY and PuTTY, make sure that <em>Attempt authentication using Pageant</em> and <em>Allow agent forwarding</em> (I’ll come to that later) are enabled where you selected your private key earlier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*ztr9L93BsLHfglkMrVvxyg.png" /></figure><p>You can remove the private key here, as that will be handled by the agent.</p><p>It’s almost the same for WinSCP:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*Rxt_TWl8uMSUNTk4hAGDOQ.png" /></figure><p>Nothing has to be changed for FileZilla, because the feature is always enabled there.</p><p>You can add even more comfort by putting the agent in your <em>Autostart</em> folder, so that it loads each time you login. To do so, press <em>Win + r </em>to access the <a href="https://en.wikipedia.org/wiki/Run_command">Run command</a> dialog, then type <em>shell:startup</em> and hit <em>Enter</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/401/1*9-GjZrErGpolA7Cb0xQlzQ.png" /></figure><p>Your <em>Autostart</em> folder should open. Right click into it and select <em>New &gt; Shortcut</em>. Insert the full path to your kageant.exe or pageant.exe, directly followed by the full path to your private key file. It should look something like this, but with your actual paths and private key’s file name of course:</p><pre>C:\Users\Iruwen\kageant.exe C:\Users\Iruwen\privkey.ppk</pre><p>Simply create the shortcut and you’re done, the agent will now start automatically on every login.</p><p>But wait, there’s more! You’re done with the configuration part here, but remember that <em>Allow agent forwarding</em> setting? That’s the real killer feature of using authentication agents, especially when you’re working on several different servers. I’ll use two of my test systems and <a href="https://mobaxterm.mobatek.net/">MobaXterm</a> here, which is the client I’m normally working with.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h806U6eP0pQCiUQbQEk7cg.png" /></figure><p>It might not be instantly obvious what’s happening here and what’s so great about it. I started two separate SSH sessions to different systems in split screen mode, so you can see both.</p><p>First I looked up and copied the external IP address of <em>fusion-small </em>on the right, because I wanted to copy a file over there from <em>fusion-tiny</em> on the left.</p><p>Without the agent running I’ve been asked for my password, because fusion-tiny doesn’t know anything about the private key required to access fusion-small. Then I started the agent on my local system, and suddenly I could copy the file over without being asked for a password.</p><p>That is because of <em>agent forwarding</em>. You’ll almost never have to think about authentication again when you’re working with multiple systems, because requests for your private key are passed on between systems, even across <em>multiple jumps</em>, so you can chain SSH connections from system to system.</p><p>Want to sync two directories between your systems? Just do it!</p><pre>rsync -a --del -e ssh /somelocaldir/ 203.56.113.178:/someremotedir/</pre><p>While this is all great, there’s also a downside: using agent forwarding comes with a security caveat, because it creates a socket which can be intercepted by anyone with sufficient permissions. In my opinion this is a minor issue and the alternative isn’t as comfortable as the author of <a href="https://heipei.io/2015/02/26/SSH-Agent-Forwarding-considered-harmful/">this article</a> makes it sound, but if you want to be super safe, only use the feature with hosts you trust, like a set of VPS where you’re the only user.</p><p>There’s one more SSH feature I’d like to show you: <em>tunnels</em>. A tunnel in general is simply a transmission channel where data enters on one side and exits somewhere else on the other; you probably have heard of or even used <em>VPN tunnels</em> already. You can use tunnels to access services you otherwise couldn’t access because of firewall limitations or geoblocking for example.</p><p>To create a tunnel, start KiTTY or PuTTY (it should work with every decent client, but I can’t explain it for all of them of course) like you’d normally do, but before you actually connect, navigate to <em>Connection &gt; SSH &gt; Tunnels</em> in the left menu. You’ll normally want to open an unused port locally on your machine and forward it to some remote port.</p><p>Imagine you want to access a service running on your Linux server. The service is listening on port 9001 on the server’s loopback interface (172.17.0.2) only, so it’s not reachable from the outside.</p><p>First enter <em>9001</em> as <em>Source port</em>, which is the port you’re gonna connect to on your <em>local system</em>. It doesn’t have to be the same as the remote port, but it has to be unused.<br>Then enter <em>172.17.0.2:9001</em> as <em>Destination</em>, which is the listening IP address and port on the remote system. If the service was listening on the <em>loopback</em> interface (localhost), this would be 127.0.0.1<em>:9001</em>. You could also enter an external IP address, then your server would be used as a <em>gateway</em> to jump to some completely different remote location.<br>Then click <em>Add</em> to add that to the list of <em>forwarded ports</em>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*mnEToIrIUGFwIreT1X3M5w.png" /></figure><p>If you enable <em>Local ports accept connections from other hosts</em> here, other systems in your local network can access the tunnel too.<br>If you change <em>Local</em> to <em>Remote</em> under the <em>Destination</em> field, you reverse the direction of the tunnel, so a remote system can access a service on your local system.</p><p>You can now <em>Open</em> the connection to the server. A normal SSH shell session appears, but there will also be a tunnel running in the background.</p><p>You can check that it worked by executing a command on the Windows command prompt. To do so, press <em>Win + r </em>to access the <a href="https://en.wikipedia.org/wiki/Run_command">Run command</a> dialog, then type <em>cmd</em> and hit <em>Enter</em>. A console window will appear, where you can use this command:</p><pre>~# netstat -na | findstr 9001</pre><p>You should get a result like this, meaning port 9001 is open and ready for connections on your local machine:</p><pre>TCP    127.0.0.1:9001         0.0.0.0:0              LISTENING</pre><p>You might see more lines, but one of them should say <em>LISTENING</em>. If it’s not there, something went wrong.</p><p>If you’re using Linux or Mac OS, the shell command achieving the same result would look like this:</p><pre>~# ssh -L <a href="http://127.0.0.1:9001/">127.0.0.1:9001</a>:<a href="http://172.17.0.2:9001/">172.17.0.2:9001</a> -l &lt;user&gt; &lt;host&gt;</pre><p>Where <em>&lt;user&gt;</em> is your login and <em>&lt;host&gt;</em> is the IP address of your server.</p><p>My Telegram username is @Iruwen, you can find me in <a href="https://t.me/CoinMarketCap">CoinMarketCap</a>’s great international community where we discuss general crypto topics. I’ll gladly try to help you out with technical questions of all sorts.</p><p>If you think this was helpful in any way, feel free to buy me a beer!</p><p>ETH: 0x0afAB9b6dA9FBb79f3260F71E4a17d4AF9AC1020<br>BTC: 16yAtsdjzEaQbH8ucK1nbtkqrpo791EZ7a</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49ac94ce1a42" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>