<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
  <title>Daniel Wayne Armstrong</title>
  <link>https://www.dwarmstrong.org</link>
  <description>Libre all the things</description>
  <generator>Zola</generator>
  <language>en</language>
  <atom:link href="https://www.dwarmstrong.org/feed.xml" rel="self" type="application/rss+xml"/>
  <lastBuildDate>Fri, 04 Sep 2026 00:00:00 +0000</lastBuildDate>
    <item>
      <title>NetBSD: After First Boot</title>
      <pubDate>Fri, 04 Sep 2026 00:00:00 +0000</pubDate>
      <link>https://www.dwarmstrong.org/netbsd-after/</link>
      <guid>https://www.dwarmstrong.org/netbsd-after/</guid>
      <description>&lt;p&gt;After the first boot of my &lt;a href=&quot;&#x2F;netbsd-encrypt-install&#x2F;&quot;&gt;NetBSD installation&lt;&#x2F;a&gt;, these are some extra steps I like to make right away to get a system off to a good start!&lt;&#x2F;p&gt;
&lt;img class=&quot;floatright&quot; src=&quot;&#x2F;img&#x2F;netbsd-logo-ascii.png&quot; alt=&quot;NetBSD logo in ASCII&quot; &#x2F;&gt;
&lt;hr &#x2F;&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-after&#x2F;#package-management&quot;&gt;Package management&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-after&#x2F;#run-commands-as-root&quot;&gt;Run commands as root&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-after&#x2F;#use-a-different-console-font&quot;&gt;Use a different console font&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-after&#x2F;#alias-for-root-mail&quot;&gt;Alias for root mail&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-after&#x2F;#check-for-vulnerable-packages&quot;&gt;Check for vulnerable packages&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-after&#x2F;#create-ssh-keys&quot;&gt;Create SSH keys&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-after&#x2F;#custom-login&quot;&gt;Custom login&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-after&#x2F;#custom-prompt&quot;&gt;Custom prompt&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-after&#x2F;#accelerate-keyboard-repeat-speed&quot;&gt;Accelerate keyboard repeat speed&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-after&#x2F;#adjust-console-brightness&quot;&gt;Adjust console brightness&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-after&#x2F;#microcode-updates&quot;&gt;Microcode updates&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-after&#x2F;#clear-console-at-logout&quot;&gt;Clear console at logout&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;hr &#x2F;&gt;
&lt;h2 id=&quot;package-management&quot;&gt;Package management&lt;&#x2F;h2&gt;
&lt;p&gt;Package management is one area where the differences between the Linux philosophy and the BSD philosophy about how to build a system becomes apparent.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Linux&lt;&#x2F;strong&gt; is an operating system kernel. Developers take this kernel and combine it with various independent software projects in a collection of &lt;strong&gt;packages&lt;&#x2F;strong&gt; that is released as a Linux &lt;strong&gt;distribution&lt;&#x2F;strong&gt; (Ubuntu, &lt;a href=&quot;&#x2F;tags&#x2F;debian&quot;&gt;Debian&lt;&#x2F;a&gt;, Fedora, etc.).&lt;&#x2F;p&gt;
&lt;p&gt;In contrast, each of the BSDs develop their own kernel and combine it with system components that are developed together “in-house” and released as a whole. The idea being that this approach leads to a more robust and tightly integrated core operating system. Third-party “userland” packages not included in the core may still be installed at the discretion of the user.&lt;&#x2F;p&gt;
&lt;p&gt;Source code and binary packages are provided by &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;man.netbsd.org&#x2F;pkgsrc.7&quot;&gt;pkgsrc(7)&lt;&#x2F;a&gt;, the NetBSD packages collection, which can be &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;cdn.netbsd.org&#x2F;pub&#x2F;pkgsrc&#x2F;current&#x2F;pkgsrc&#x2F;index-all.html&quot;&gt;viewed online&lt;&#x2F;a&gt; sorted alphabetically. Install binary packages directly from remote package repositories using &lt;code&gt;pkgin&lt;&#x2F;code&gt;, a user-friendly frontend to the &lt;code&gt;pkg_*&lt;&#x2F;code&gt; tools.&lt;&#x2F;p&gt;
&lt;p&gt;Switch to root if not already logged in as such:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;su -&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Set &lt;code&gt;PKG_PATH&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PKG_PATH=&amp;quot;http:&#x2F;&#x2F;cdn.NetBSD.org&#x2F;pub&#x2F;pkgsrc&#x2F;packages&#x2F;NetBSD&#x2F;$(uname -p)&#x2F;$(uname -r|cut -f &amp;#39;1 2&amp;#39; -d.)&#x2F;All&#x2F;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;export PKG_PATH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Install:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkg_add pkgin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkg_add -v mozilla-rootcerts-openssl&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To keep packages up-to-date, compare installed packages to the versions available in repositories and generate a list of packages due for an upgrade by running the command:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkgin update&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To add a package:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkgin install [package]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;One of the first packages I like to install on any BSD or Linux system is &lt;code&gt;sl(1)&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkgin install sl&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;More: &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.netbsd.org&#x2F;docs&#x2F;guide&#x2F;en&#x2F;chap-boot.html#chap-boot-pkgsrc&quot;&gt;NetBSD Guide: Installing additional software&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;run-commands-as-root&quot;&gt;Run commands as root&lt;&#x2F;h2&gt;
&lt;p&gt;I created a user account (example: &lt;code&gt;foo&lt;&#x2F;code&gt;) during installation and added myself to the &lt;code&gt;wheel&lt;&#x2F;code&gt; group.&lt;&#x2F;p&gt;
&lt;p&gt;Install &lt;code&gt;doas&lt;&#x2F;code&gt; to run root-level access commands, and allow members of &lt;code&gt;wheel&lt;&#x2F;code&gt; to do so by default, by creating &lt;code&gt;doas.conf&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkgin install doas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;echo &amp;quot;permit :wheel&amp;quot; &amp;gt; &#x2F;usr&#x2F;pkg&#x2F;etc&#x2F;doas.conf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To allow user &lt;code&gt;foo&lt;&#x2F;code&gt; to run commands as root without asking for a password:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;echo &amp;quot;permit nopass keepenv foo&amp;quot; &amp;gt;&amp;gt; &#x2F;usr&#x2F;pkg&#x2F;etc&#x2F;doas.conf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Log out as &lt;code&gt;root&lt;&#x2F;code&gt;, log back in as your user, and use &lt;code&gt;doas&lt;&#x2F;code&gt; to run any commands that require root privileges.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;use-a-different-console-font&quot;&gt;Use a different console font&lt;&#x2F;h2&gt;
&lt;p&gt;The base system includes a selection of console fonts in &lt;code&gt;&#x2F;usr&#x2F;share&#x2F;wscons&#x2F;fonts&lt;&#x2F;code&gt;. I like the &lt;code&gt;Terminus&lt;&#x2F;code&gt; font.&lt;&#x2F;p&gt;
&lt;p&gt;Open the &lt;code&gt;wscons.conf&lt;&#x2F;code&gt; file for editing:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;doas vi &#x2F;etc&#x2F;wscons.conf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Uncomment the desired &lt;code&gt;TerminusXX&lt;&#x2F;code&gt; font size, and set the font for use in the console:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;font    Terminus32-ISO8859-1    - - -   &#x2F;usr&#x2F;share&#x2F;wscons&#x2F;fonts&#x2F;ter-132n.wsf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;setvar  ttyE0   font            Terminus32-ISO8859-1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;setvar  ttyE1   font            Terminus32-ISO8859-1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;setvar  ttyE2   font            Terminus32-ISO8859-1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;setvar  ttyE3   font            Terminus32-ISO8859-1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Save changes and exit.&lt;&#x2F;p&gt;
&lt;p&gt;Restart:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;doas service wscons restart&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;More: &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.netbsd.org&#x2F;docs&#x2F;guide&#x2F;en&#x2F;chap-cons.html&quot;&gt;NetBSD Guide: Console drivers&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;alias-for-root-mail&quot;&gt;Alias for root mail&lt;&#x2F;h2&gt;
&lt;p&gt;Rather than login to root to collect system mail, I forward the root user’s mail to my non-root user’s inbox.&lt;&#x2F;p&gt;
&lt;p&gt;Open the &lt;code&gt;aliases&lt;&#x2F;code&gt; file for editing:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;doas vi &#x2F;etc&#x2F;mail&#x2F;aliases&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Modify:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# root:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# operator:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;… uncomment the lines and add my username (example: &lt;code&gt;foo&lt;&#x2F;code&gt;):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;root:           foo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;operator:       foo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Save changes and exit.&lt;&#x2F;p&gt;
&lt;p&gt;Let the MTA know about the modification by running the &lt;code&gt;newaliases(1)&lt;&#x2F;code&gt; command with no arguments:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;doas newaliases&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Test whether mail is indeed being forwarded by using the &lt;code&gt;mail(1)&lt;&#x2F;code&gt; command as my user to send root a message:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ mail root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Subject: Test new aliases&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Is it working?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Press &lt;code&gt;CTRL-d&lt;&#x2F;code&gt; to exit and send message.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ mail&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Mail version 9.1alpha 2009-02-25.  Type ? for help.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;quot;&#x2F;var&#x2F;mail&#x2F;foo&amp;quot;: 1 message 1 new&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;N  1 foo@bsdbox.home.arp  Wed Sep  2 11:51   3&#x2F;456   &amp;quot;Test new aliases&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;check-for-vulnerable-packages&quot;&gt;Check for vulnerable packages&lt;&#x2F;h2&gt;
&lt;p&gt;Set the system to automatically run a daily update of its local database of known vulnerable packages, check if any of these packages are installed, and inform the user if so:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;echo &amp;quot;fetch_pkg_vulnerabilities=YES&amp;quot; | doas tee -a &#x2F;etc&#x2F;daily.conf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;By default this job will run in the early morning hours. For a machine that is typically powered off at night, I modify the time that &lt;code&gt;&#x2F;etc&#x2F;daily&lt;&#x2F;code&gt; is executed to the middle of the day.&lt;&#x2F;p&gt;
&lt;p&gt;Run:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;doas crontab -e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Modify:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# do daily&#x2F;weekly&#x2F;monthly maintenance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;15	12	*	*	*	&#x2F;bin&#x2F;sh &#x2F;etc&#x2F;daily 2&amp;gt;&amp;amp;1 | tee &#x2F;var&#x2F;log&#x2F;daily.out | sendmail -t&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;30	12	*	*	6	&#x2F;bin&#x2F;sh &#x2F;etc&#x2F;weekly 2&amp;gt;&amp;amp;1 | tee &#x2F;var&#x2F;log&#x2F;weekly.out | sendmail -t&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Save changes and exit.&lt;&#x2F;p&gt;
&lt;p&gt;More: &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;man.netbsd.org&#x2F;NetBSD-11.0&#x2F;afterboot.8&quot;&gt;afterboot(8)&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;create-ssh-keys&quot;&gt;Create SSH Keys&lt;&#x2F;h2&gt;
&lt;p&gt;Create an SSH public&#x2F;private key pair to facilitate passwordless logins to remote servers and (optional) configure remote access to the localhost. &lt;a href=&quot;&#x2F;netbsd-ssh-keys&#x2F;&quot;&gt;Read More&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;custom-login&quot;&gt;Custom login&lt;&#x2F;h2&gt;
&lt;p&gt;After entering a username and password, the NetBSD default login generates multiple lines of output, some of it more useful (&lt;code&gt;Last login&lt;&#x2F;code&gt;) than others (copyright dates). &lt;a href=&quot;&#x2F;netbsd-login&#x2F;&quot;&gt;Read More&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;custom-prompt&quot;&gt;Custom prompt&lt;&#x2F;h2&gt;
&lt;p&gt;I set my user prompt to display the &lt;code&gt;hostname&lt;&#x2F;code&gt; and current working directory.&lt;&#x2F;p&gt;
&lt;p&gt;For the &lt;code&gt;sh&lt;&#x2F;code&gt; shell, open &lt;code&gt;.shrc&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;vi ~&#x2F;.shrc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Add:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Enable command execution in prompt strings&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;set -o promptcmds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;get_pwd() {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	case &amp;quot;$PWD&amp;quot; in&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		&amp;quot;$HOME&amp;quot;) echo &amp;quot;~&amp;quot; ;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		&amp;quot;$HOME&amp;quot;&#x2F;*) echo &amp;quot;~${PWD#$HOME}&amp;quot; ;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		*) echo &amp;quot;$PWD&amp;quot; ;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	esac&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PS1=&amp;#39;$(hostname -s):$(get_pwd)\$ &amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Save changes and exit.&lt;&#x2F;p&gt;
&lt;p&gt;Reload the config:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;. ~&#x2F;.shrc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;accelerate-keyboard-repeat-speed&quot;&gt;Accelerate keyboard repeat speed&lt;&#x2F;h2&gt;
&lt;p&gt;The speed at which a key press is repeated can be accelerated by modifying &lt;code&gt;wscons.conf&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;doas vi &#x2F;etc&#x2F;wscons.conf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Adjust these two variable: &lt;code&gt;repeat.del1&lt;&#x2F;code&gt;, which specifies the delay (in milliseconds) before character repetition starts, and &lt;code&gt;repeat.deln&lt;&#x2F;code&gt;, which sets the delay between each character repetition once started.&lt;&#x2F;p&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Change keyboard repeat speed to faster settings.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;setvar	wskbd	repeat.del1	300&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;setvar	wskbd	repeat.deln	20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Save changes and exit.&lt;&#x2F;p&gt;
&lt;p&gt;Restart to activate:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;doas service wscons restart&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;adjust-console-brightness&quot;&gt;Adjust console brightness&lt;&#x2F;h2&gt;
&lt;p&gt;All my laptops have integrated Intel graphics, and to adjust the console brightness I use &lt;code&gt;intel-backlight&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Install:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;doas pkgin install intel-backlight&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Display current brightness:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ intel_backlight&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Current backlight value: 33% (505&#x2F;1515)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Set brightness to 100%:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ intel_backlight 100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Current backlight value: 100% (1515&#x2F;1515)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This only lasts for the current session. To auto-enable at boot, modify &lt;code&gt;rc.local&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;doas vi &#x2F;etc&#x2F;rc.local&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Add:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# set screen brightness to 100% on boot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if [ -x &#x2F;usr&#x2F;pkg&#x2F;sbin&#x2F;intel_backlight ]; then&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&#x2F;usr&#x2F;pkg&#x2F;sbin&#x2F;intel_backlight 100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Save changes and exit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;microcode-updates&quot;&gt;Microcode updates&lt;&#x2F;h2&gt;
&lt;p&gt;For devices with Intel CPUs, install:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;doas pkgin install intel-microcode-netbsd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To use &lt;code&gt;intel-microcode-netbsd-&amp;lt;DATE&amp;gt;&lt;&#x2F;code&gt; to update your system’s microcode, verify that &lt;code&gt;hw.firmware.path&lt;&#x2F;code&gt; includes your pkgsrc prefix:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ &#x2F;sbin&#x2F;sysctl hw.firmware.path&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hw.firmware.path = &#x2F;libdata&#x2F;firmware:&#x2F;usr&#x2F;libdata&#x2F;firmware:&#x2F;usr&#x2F;pkg&#x2F;libdata&#x2F;firmware:&#x2F;usr&#x2F;pkg&#x2F;libdata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Copy the sample &lt;code&gt;rc.d&lt;&#x2F;code&gt; file to apply updates during the boot process to &lt;code&gt;&#x2F;etc&#x2F;rc.d&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;doas cp &#x2F;usr&#x2F;pkg&#x2F;share&#x2F;examples&#x2F;rc.d&#x2F;intel-microcode &#x2F;etc&#x2F;rc.d&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To ensure the configurations are correct without rebooting, manually trigger the initialization script:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;doas &#x2F;etc&#x2F;rc.d&#x2F;intel-microcode start&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If it silently exist, the config is OK.&lt;&#x2F;p&gt;
&lt;p&gt;Add &lt;code&gt;microcode=YES&lt;&#x2F;code&gt; to my &lt;code&gt;&#x2F;etc&#x2F;rc.conf&lt;&#x2F;code&gt; and reboot.&lt;&#x2F;p&gt;
&lt;p&gt;Verify:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cpuctl identify 0 | grep -i microcode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cpu0: microcode version 0xf6, platform ID 7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;clear-console-at-logout&quot;&gt;Clear console at logout&lt;&#x2F;h2&gt;
&lt;p&gt;For the default &lt;code&gt;sh&lt;&#x2F;code&gt; shell, I create the &lt;code&gt;.exitrc&lt;&#x2F;code&gt; file:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;echo &amp;quot;type clear &amp;gt;&#x2F;dev&#x2F;null 2&amp;gt;&amp;amp;1 &amp;amp;&amp;amp; clear&amp;quot; &amp;gt; ~&#x2F;.exitrc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Modify &lt;code&gt;.shrc&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;vi ~&#x2F;.shrc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Add:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;case &amp;quot;$-&amp;quot; in *i*)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # interactive mode settings go here&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    .&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    .&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    .&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Clear terminal at logout&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    test -f $HOME&#x2F;.exitrc &amp;amp;&amp;amp; trap &amp;quot;. $HOME&#x2F;.exitrc&amp;quot; EXIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;esac&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Save changes and exit.&lt;&#x2F;p&gt;
&lt;p&gt;More: &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;unix.stackexchange.com&#x2F;a&#x2F;12013&quot;&gt;How to clear terminal after logging out?&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p class=&quot;mastodon&quot;&gt;
You can like, share, or comment on this post &lt;a href=&quot;https:&#x2F;&#x2F;fosstodon.org&#x2F;@dwarmstrong&#x2F;117213185021160886&quot; target=&quot;_blank&quot;&gt;on the Fediverse&lt;&#x2F;a&gt; &amp;#128172
&lt;&#x2F;p&gt;
</description>
    </item>
    <item>
      <title>Customize the Login on NetBSD</title>
      <pubDate>Thu, 03 Sep 2026 00:00:00 +0000</pubDate>
      <link>https://www.dwarmstrong.org/netbsd-login/</link>
      <guid>https://www.dwarmstrong.org/netbsd-login/</guid>
      <description>&lt;p&gt;After entering a username and password, the NetBSD default login generates multiple lines of output, some of it more useful (&lt;code&gt;Last login&lt;&#x2F;code&gt;) than others (copyright dates).&lt;&#x2F;p&gt;
&lt;p&gt;To quiet this output, I create an empty &lt;code&gt;hushlogin&lt;&#x2F;code&gt; file in HOME:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;touch ~&#x2F;.hushlogin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;However, this removes the &lt;code&gt;Last login&lt;&#x2F;code&gt; output, which I &lt;strong&gt;do&lt;&#x2F;strong&gt; want to display. I re-create the information using &lt;code&gt;last(1)&lt;&#x2F;code&gt; in a custom script.&lt;&#x2F;p&gt;
&lt;p&gt;Create the &lt;code&gt;bin&lt;&#x2F;code&gt; directory in HOME:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mkdir ~&#x2F;bin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Create &lt;code&gt;mylastlogin&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;vi ~&#x2F;bin&#x2F;mylastlogin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;…with:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#!&#x2F;bin&#x2F;sh&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Show last login information if available&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if command -v last &amp;gt;&#x2F;dev&#x2F;null 2&amp;gt;&amp;amp;1; then&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    last | grep $USER &amp;gt; &#x2F;tmp&#x2F;logins&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sed -i.bak &amp;#39;&#x2F;boot&#x2F;d;&#x2F;shutdown&#x2F;d;&#x2F;reboot&#x2F;d;&#x2F;tmux&#x2F;d&amp;#39; &#x2F;tmp&#x2F;logins&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    head -2 &#x2F;tmp&#x2F;logins | tail -1 | tr -s &amp;#39; &amp;#39; &amp;gt; &#x2F;tmp&#x2F;last&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    logdate=&amp;quot;$( cat &#x2F;tmp&#x2F;last | cut -d &amp;#39; &amp;#39; -f 3- )&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    logtty=&amp;quot;$( cat &#x2F;tmp&#x2F;last | cut -d &amp;#39; &amp;#39; -f 2 )&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    echo &amp;quot;Last login: $logdate on $logtty&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Save changes and exit.&lt;&#x2F;p&gt;
&lt;p&gt;Make the script executable:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;chmod 700 ~&#x2F;bin&#x2F;mylastlogin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Modify &lt;code&gt;.profile&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;vi ~&#x2F;.profile&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Add:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Show last login information if available&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if command -v mylastlogin &amp;gt;&#x2F;dev&#x2F;null 2&amp;gt;&amp;amp;1; then&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mylastlogin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Save changes and exit.&lt;&#x2F;p&gt;
&lt;p class=&quot;mastodon&quot;&gt;
You can like, share, or comment on this post &lt;a href=&quot;https:&#x2F;&#x2F;fosstodon.org&#x2F;@dwarmstrong&#x2F;117207286898266741&quot; target=&quot;_blank&quot;&gt;on the Fediverse&lt;&#x2F;a&gt; &amp;#128172
&lt;&#x2F;p&gt;
</description>
    </item>
    <item>
      <title>Configure SSH for Passwordless Logins to NetBSD Servers</title>
      <pubDate>Sun, 23 Aug 2026 00:00:00 +0000</pubDate>
      <link>https://www.dwarmstrong.org/netbsd-ssh-keys/</link>
      <guid>https://www.dwarmstrong.org/netbsd-ssh-keys/</guid>
      <description>&lt;p&gt;Create SSH keys on a NetBSD &lt;strong&gt;CLIENT&lt;&#x2F;strong&gt; that will be used to secure access to remote devices. Disable password logins on a NetBSD &lt;strong&gt;SERVER&lt;&#x2F;strong&gt; in favour of using SSH keys for authentication.&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-ssh-keys&#x2F;#start-here&quot;&gt;Start Here&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-ssh-keys&#x2F;#create-public-and-private-keys&quot;&gt;Create Public and Private Keys&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-ssh-keys&#x2F;#share-public-key&quot;&gt;Share Public Key&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-ssh-keys&#x2F;#disable-password-logins&quot;&gt;Disable Password Logins&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-ssh-keys&#x2F;#create-an-alias&quot;&gt;Create an Alias&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-ssh-keys&#x2F;#keychain&quot;&gt;Keychain&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;hr &#x2F;&gt;
&lt;h2 id=&quot;start-here&quot;&gt;Start Here&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;on-both-the-client-and-the-server&quot;&gt;On BOTH the CLIENT and the SERVER&lt;&#x2F;h3&gt;
&lt;p&gt;Create the &lt;code&gt;.ssh&lt;&#x2F;code&gt; directory and &lt;code&gt;authorized_keys&lt;&#x2F;code&gt; file in &lt;code&gt;$HOME&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mkdir ~&#x2F;.ssh &amp;amp;&amp;amp; touch ~&#x2F;.ssh&#x2F;authorized_keys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;chmod 700 ~&#x2F;.ssh &amp;amp;&amp;amp; chmod 600 ~&#x2F;.ssh&#x2F;authorized_keys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;create-public-and-private-keys&quot;&gt;Create Public and Private Keys&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;on-the-client&quot;&gt;On the CLIENT&lt;&#x2F;h3&gt;
&lt;p&gt;Create the SSH public&#x2F;private key pair protected with a passphrase using &lt;code&gt;ssh-keygen(1)&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ssh-keygen -t ed25519 -C &amp;quot;$(whoami)@$(hostname -s)-$(date +%Y-%m-%d)&amp;quot; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Start &lt;code&gt;ssh-agent(1)&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eval &amp;quot;$(ssh-agent -s)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Add the newly-created SSH private key to the current session using &lt;code&gt;ssh-add(1)&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ssh-add ~&#x2F;.ssh&#x2F;id_ed25519&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Any SSH logins launched during the session will now access this key stored in memory.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;share-public-key&quot;&gt;Share Public Key&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;on-the-client-1&quot;&gt;On the CLIENT&lt;&#x2F;h3&gt;
&lt;p&gt;Upload the public key using &lt;code&gt;ssh-copy-id(1)&lt;&#x2F;code&gt; to the SERVER and append to its &lt;code&gt;authorized_keys&lt;&#x2F;code&gt; file:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ssh-copy-id -i ~&#x2F;.ssh&#x2F;id_ed25519.pub [remote_ip_address]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Example: SERVER has a &lt;code&gt;[remote_ip_address]&lt;&#x2F;code&gt; of &lt;code&gt;178.123.1.45&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ssh-copy-id -i ~&#x2F;.ssh&#x2F;id_ed25519.pub 178.123.1.45&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Verify key-based authentication is configured correctly by successfully logging in using &lt;code&gt;ssh(1)&lt;&#x2F;code&gt; without a password:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ssh -o PasswordAuthentication=no 178.123.1.45&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;disable-password-logins&quot;&gt;Disable Password Logins&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;on-the-server&quot;&gt;On the SERVER&lt;&#x2F;h3&gt;
&lt;p&gt;After verifying the SERVER can be accessed remotely using SSH keys, open &lt;code&gt;sshd_config&lt;&#x2F;code&gt; for editing:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;vi &#x2F;etc&#x2F;ssh&#x2F;sshd_config&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Disable password authentication (and root logins) with these modifications:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PermitRootLogin no&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PubkeyAuthentication yes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PasswordAuthentication no&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;KbdInteractiveAuthentication no&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Save changes and exit.&lt;&#x2F;p&gt;
&lt;p&gt;Reload SSH:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;service sshd reload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;on-the-client-2&quot;&gt;On the CLIENT&lt;&#x2F;h3&gt;
&lt;p&gt;While remaining logged into SERVER, open another terminal and verify the changes by attempting a new login using password authentication (which should &lt;strong&gt;fail&lt;&#x2F;strong&gt;):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no 178.123.1.45&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;username&amp;gt;@178.123.1.45: Permission denied (publickey).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Verify key-based authentication continues to work as before:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ssh 178.123.1.45&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Device is now secured to accept only SSH key authentication for logins.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;create-an-alias&quot;&gt;Create An Alias&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;on-the-client-3&quot;&gt;On the CLIENT&lt;&#x2F;h3&gt;
&lt;p&gt;Create an alias for the SERVER in the user’s &lt;code&gt;ssh_config&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;vi ~&#x2F;.ssh&#x2F;config&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Add an alias for SERVER named &lt;code&gt;myserver&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Host myserver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  HostName 178.123.1.45&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Save changes and exit.&lt;&#x2F;p&gt;
&lt;p&gt;Now login to SERVER is simply:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ssh myserver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;keychain&quot;&gt;Keychain&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;on-the-client-4&quot;&gt;On the CLIENT&lt;&#x2F;h3&gt;
&lt;p&gt;For CLIENT devices that are not running desktop environments with their own built-in &lt;code&gt;ssh&lt;&#x2F;code&gt; key management tools, I like to install &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;danielrobbins&#x2F;keychain&quot;&gt;keychain&lt;&#x2F;a&gt; to manage my keys:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pkgin install keychain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;When logging in for the first time after boot, it prompts me for the passphrase to unlock my key, then will maintain a single &lt;code&gt;ssh-agent&lt;&#x2F;code&gt; process across multiple login sessions.&lt;&#x2F;p&gt;
&lt;p&gt;Flush all cached keys from memory:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;keychain --clear                  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Configure the user’s SHELL to launch &lt;code&gt;keychain&lt;&#x2F;code&gt; at login and unlock the user’s private SSH key.&lt;&#x2F;p&gt;
&lt;p&gt;Example: If using &lt;code&gt;sh&lt;&#x2F;code&gt; as SHELL, open &lt;code&gt;.shrc&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;vi ~&#x2F;.shrc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Add:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;case &amp;quot;$-&amp;quot; in *i*)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	# interactive mode settings go here&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	if command -v keychain 2&amp;gt;&amp;amp;1 &amp;gt;&#x2F;dev&#x2F;null; then&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		eval $(keychain --eval id_ed25519)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	fi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;esac&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Save changes and exit.&lt;&#x2F;p&gt;
&lt;p class=&quot;mastodon&quot;&gt;
You can like, share, or comment on this post &lt;a href=&quot;https:&#x2F;&#x2F;fosstodon.org&#x2F;@dwarmstrong&#x2F;115016465014478640&quot; target=&quot;_blank&quot;&gt;on the Fediverse&lt;&#x2F;a&gt; &amp;#128172
&lt;&#x2F;p&gt;
</description>
    </item>
    <item>
      <title>NetBSD 11.0 Installation with Disk Encryption</title>
      <pubDate>Sat, 22 Aug 2026 00:00:00 +0000</pubDate>
      <link>https://www.dwarmstrong.org/netbsd-encrypt-install/</link>
      <guid>https://www.dwarmstrong.org/netbsd-encrypt-install/</guid>
      <description>&lt;p&gt;The first time I installed &lt;a href=&quot;&#x2F;netbsd-install&#x2F;&quot;&gt;NetBSD&lt;&#x2F;a&gt; I used &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;man.netbsd.org&#x2F;sysinst.8&quot;&gt;sysinst(8)&lt;&#x2F;a&gt;, a menu-based program launched at boot that runs in the console. It has a clear and concise layout and I was quickly up-and-running on my new &lt;a href=&quot;&#x2F;tags&#x2F;bsd&quot;&gt;BSD&lt;&#x2F;a&gt; system.&lt;&#x2F;p&gt;
&lt;p&gt;For my &lt;strong&gt;next&lt;&#x2F;strong&gt; install I wanted to include &lt;strong&gt;disk encryption&lt;&#x2F;strong&gt; to protect personal data in case the device is lost or stolen. Its not really enough to simply encrypt home directories. Passphrases and sensitive data can linger and be extracted from locations such as system logs and swap memory. There is a trade-off to be made between how much to encrypt, the convenience of operating the system, and the ability for the system to boot.&lt;&#x2F;p&gt;
&lt;img class=&quot;floatright&quot; src=&quot;&#x2F;img&#x2F;ascii_kitty.png&quot; alt=&quot;ascii kitty&quot; width=467 height=158 &#x2F;&gt;
&lt;hr &#x2F;&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#start-here&quot;&gt;Start Here&lt;&#x2F;a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#acquire-an-installation-image&quot;&gt;Acquire an installation image&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#prepare-the-usb-installation-medium&quot;&gt;Prepare the USB installation medium&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#configure-the-live-environment&quot;&gt;Configure the Live Environment&lt;&#x2F;a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#connect-to-the-internet&quot;&gt;Connect to the internet&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#remote-login-to-the-installer&quot;&gt;Remote login to the installer&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#prepare-the-disk&quot;&gt;Prepare the DISK&lt;&#x2F;a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#identify-disks-and-partitions&quot;&gt;Identify disks and partitions&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#define-disk-variable&quot;&gt;Define DISK variable&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#wipe-disk&quot;&gt;Wipe DISK&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#partition-disk&quot;&gt;Partition DISK&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#define-wedge-variables&quot;&gt;Define wedge variables&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#format-and-mount-the-esp-wedge&quot;&gt;Format and mount the ESP wedge&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#add-efi-boot-entries-to-esp&quot;&gt;Add EFI boot entries to ESP&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#format-and-mount-the-root-wedge&quot;&gt;Format and mount the root wedge&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#disk-encryption&quot;&gt;Disk Encryption&lt;&#x2F;a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#create-encrypted-device&quot;&gt;Create encrypted device&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#create-disklabels&quot;&gt;Create disklabels&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#verify-encrypted-device&quot;&gt;Verify encrypted device&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#format-and-mount-disklabels&quot;&gt;Format and mount disklabels&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#installation&quot;&gt;Installation&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#configure-the-system&quot;&gt;Configure the System&lt;&#x2F;a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#chroot&quot;&gt;Chroot&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#directories&quot;&gt;Directories&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#devices&quot;&gt;Devices&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#root-password&quot;&gt;Root password&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#superuser&quot;&gt;Superuser&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#fstab&quot;&gt;Fstab&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#startup&quot;&gt;Startup&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#keyboard&quot;&gt;Keyboard&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#timezone&quot;&gt;Timezone&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#network-interface&quot;&gt;Network interface&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#terminals&quot;&gt;Terminals&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#finish-up&quot;&gt;Finish Up&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;netbsd-encrypt-install&#x2F;#resources&quot;&gt;Resources&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;hr &#x2F;&gt;
&lt;h2 id=&quot;start-here&quot;&gt;Start Here&lt;&#x2F;h2&gt;
&lt;p&gt;Throughout this HOWTO, if you see square brackets &lt;code&gt;[]&lt;&#x2F;code&gt; in code blocks, that means the word of code (square brackets included) should be replaced with something else. This is detailed in the instructions before or after the code block.&lt;&#x2F;p&gt;
&lt;p&gt;NetBSD will be installed as the sole operating system on a single disk using a four-partition layout:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Partition &lt;code&gt;ESP&lt;&#x2F;code&gt; is the EFI system partition.&lt;&#x2F;li&gt;
&lt;li&gt;Partition &lt;code&gt;root&lt;&#x2F;code&gt; hosts a minimal root filesystem that boots to an encryption passphrase prompt, which upon entry unlocks…&lt;&#x2F;li&gt;
&lt;li&gt;… the encrypted device on partition &lt;code&gt;syscgd&lt;&#x2F;code&gt; containing the contents of &lt;code&gt;var&lt;&#x2F;code&gt;, &lt;code&gt;usr&lt;&#x2F;code&gt;, and &lt;code&gt;home&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Partition &lt;code&gt;swap&lt;&#x2F;code&gt; is swap memory auto-encrypted at boot using a random key.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A few assumptions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Target device is &lt;code&gt;amd64&lt;&#x2F;code&gt; architecture using UEFI to boot.&lt;&#x2F;li&gt;
&lt;li&gt;Secure boot is disabled on target device.&lt;&#x2F;li&gt;
&lt;li&gt;Network access during install uses a wired interface.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Sysinst does not provide the option for encrypting the system in this manner, so early in the install process I switch to the console and proceed to manually install NetBSD.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;acquire-an-installation-image&quot;&gt;Acquire an installation image&lt;&#x2F;h3&gt;
&lt;p&gt;The latest official installation images (as of August 2026) are available here: &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;cdn.netbsd.org&#x2F;pub&#x2F;NetBSD&#x2F;images&#x2F;11.0&#x2F;&quot;&gt;Images and torrents&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Download the &lt;code&gt;NetBSD-11.0-amd64-install.img.gz&lt;&#x2F;code&gt; image and the &lt;code&gt;SHA512&lt;&#x2F;code&gt; file for verification:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;wget https:&#x2F;&#x2F;cdn.netbsd.org&#x2F;pub&#x2F;NetBSD&#x2F;images&#x2F;11.0&#x2F;NetBSD-11.0-amd64-install.img.gz&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;wget https:&#x2F;&#x2F;cdn.netbsd.org&#x2F;pub&#x2F;NetBSD&#x2F;images&#x2F;11.0&#x2F;SHA512&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Verify the image using &lt;code&gt;sha512sum&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sha512sum -c --ignore-missing SHA512 &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Decompress the image:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gunzip NetBSD-11.0-amd64-install.img.gz&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;prepare-the-usb-installation-medium&quot;&gt;Prepare the USB installation medium&lt;&#x2F;h3&gt;
&lt;p&gt;Write the installer to an &lt;strong&gt;unmounted&lt;&#x2F;strong&gt; USB storage device running the &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;man.netbsd.org&#x2F;dd.1&quot;&gt;dd(1)&lt;&#x2F;a&gt; command as &lt;code&gt;root&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;WARNING&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
&lt;strong&gt;Be very careful to note the proper device (which can be identified with &lt;code&gt;lsblk&lt;&#x2F;code&gt;). All contents on the device will be lost!&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Example: On a Linux system, if a USB stick appears as &lt;code&gt;sdx1&lt;&#x2F;code&gt;, then write the installer to &lt;code&gt;sdx&lt;&#x2F;code&gt; (omit partition number):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dd bs=4M conv=fsync oflag=direct status=progress if=NetBSD-11.0-amd64-install.img of=&#x2F;dev&#x2F;sdx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;configure-the-live-environment&quot;&gt;Configure the Live Environment&lt;&#x2F;h2&gt;
&lt;p&gt;Boot the target device from the NetBSD installation medium. Select Option &lt;code&gt;1&lt;&#x2F;code&gt; (default) to &lt;code&gt;Install NetBSD&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;After the installer has successfully booted into the NetBSD kernel, a prompt appears to select which &lt;strong&gt;language&lt;&#x2F;strong&gt; will be used for installation messages, followed by a prompt to select a different &lt;strong&gt;keyboard type&lt;&#x2F;strong&gt; if desired or leave unchanged.&lt;&#x2F;p&gt;
&lt;p&gt;Next up the menu-based &lt;strong&gt;sysinst&lt;&#x2F;strong&gt; program is launched:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;NetBSD-11.0 Install System&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;a: Install NetBSD to hard disk&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; b: Upgrade NetBSD on a hard disk&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; c: Re-install sets or install additional sets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; d: Reboot the computer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; e: Utility menu&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; f: Config menu&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; x: Exit Install System&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;connect-to-the-internet&quot;&gt;Connect to the internet&lt;&#x2F;h3&gt;
&lt;p&gt;At the &lt;code&gt;Install System&lt;&#x2F;code&gt; main menu, select &lt;code&gt;&amp;gt;e: Utility menu&lt;&#x2F;code&gt; then &lt;code&gt;&amp;gt;c: Configure network&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;Available interfaces&lt;&#x2F;code&gt; lists the network interfaces detected by the NetBSD installer.&lt;&#x2F;p&gt;
&lt;p&gt;Example: With my target device &lt;code&gt;Available interfaces&lt;&#x2F;code&gt; lists two: &lt;code&gt;wm0&lt;&#x2F;code&gt; (wired) and &lt;code&gt;iwn0&lt;&#x2F;code&gt; (wireless). I choose to configure the wired ethernet interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Network media (empty to autoconfigure) [autoselect]: &amp;lt;enter&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Perform autoconfiguration?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;a: Yes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Your host name: foobox&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Your DNS domain: home.arpa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;The following are the values you entered.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[...]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Are they OK?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;a: Yes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;remote-login-to-the-installer&quot;&gt;Remote login to the installer&lt;&#x2F;h3&gt;
&lt;p&gt;Make this manual installation process easier (i.e. cut-n-paste commands) by remotely logging into the installer via &lt;code&gt;ssh&lt;&#x2F;code&gt; from another computer.&lt;&#x2F;p&gt;
&lt;p&gt;Open a shell by selecting &lt;code&gt;&amp;gt;a: Run &#x2F;bin&#x2F;sh&lt;&#x2F;code&gt; from the &lt;code&gt;Utilities&lt;&#x2F;code&gt; menu.&lt;&#x2F;p&gt;
&lt;p&gt;Set a password for &lt;code&gt;root&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;passwd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Open the &lt;code&gt;sshd_config&lt;&#x2F;code&gt; file for editing using the &lt;code&gt;vi&lt;&#x2F;code&gt; editor:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;vi &#x2F;etc&#x2F;ssh&#x2F;sshd_config&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Set permission to allow &lt;code&gt;root&lt;&#x2F;code&gt; to login:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PermitRootLogin yes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Save changes and exit.&lt;&#x2F;p&gt;
&lt;p&gt;Start the &lt;code&gt;sshd&lt;&#x2F;code&gt; daemon:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;etc&#x2F;rc.d&#x2F;sshd onestart&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Retrieve the IP address for the active interface configured earlier (example: &lt;code&gt;wm0&lt;&#x2F;code&gt;):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ifconfig wm0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Switch to the other computer and &lt;code&gt;ssh&lt;&#x2F;code&gt; into the target device:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ssh root@[ip_address]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;…where &lt;code&gt;[ip_address]&lt;&#x2F;code&gt; is the target device’s address obtained with the &lt;code&gt;ifconfig&lt;&#x2F;code&gt; command above.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;prepare-the-disk&quot;&gt;Prepare the DISK&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
For the purposes of this HOWTO, the example target device has a single NVMe disk with an existing install of &lt;a href=&quot;&#x2F;tags&#x2F;linux&quot;&gt;Linux&lt;&#x2F;a&gt; that will be erased and replaced by NetBSD. Device IDs and storage sizes will vary between devices.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;identify-disks-and-partitions&quot;&gt;Identify disks and partitions&lt;&#x2F;h3&gt;
&lt;p&gt;Discover what disk devices and partitions have been recognized by the kernel:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# sysctl hw.disknames&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hw.disknames = ld0 dk0 dk1 dk2 dk3 sd0 dk4 dk5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;NVMe devices show up as &lt;code&gt;ld&lt;&#x2F;code&gt; and hard disks are identified by &lt;code&gt;wd&lt;&#x2F;code&gt;. USB devices usually show up as &lt;code&gt;sd&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;dk&lt;&#x2F;code&gt; devices are partitions (know as &lt;strong&gt;wedges&lt;&#x2F;strong&gt; in NetBSD parlance) on the storage devices, and this early after boot are usually displayed in order, that is: &lt;code&gt;dk0&lt;&#x2F;code&gt; through &lt;code&gt;dk3&lt;&#x2F;code&gt; are wedges on the NVMe target device &lt;code&gt;ld0&lt;&#x2F;code&gt;, and &lt;code&gt;dk4&lt;&#x2F;code&gt; and &lt;code&gt;dk5&lt;&#x2F;code&gt; on the USB installer &lt;code&gt;sd0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Verify by asking for a list of wedges on &lt;code&gt;sd0&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# dkctl sd0 listwedges&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;dev&#x2F;rsd0: 2 wedges:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dk4: EFI system, 262144 blocks at 2048, type: msdos&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dk5: 30c4cc4e-5369-449c-8994-a4b1ea665b4b, 4853760 blocks at 264192, type: ffs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Verify which device the installer booted from:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# dmesg | fgrep &amp;quot;root on&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[     4.158650] root on dk5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;define-disk-variable&quot;&gt;Define DISK variable&lt;&#x2F;h3&gt;
&lt;p&gt;The NVMe storage device detected above as &lt;code&gt;ld0&lt;&#x2F;code&gt; is where NetBSD will be installed. Adjust accordingly for your own storage device:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;DISK=&amp;quot;ld0&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;wipe-disk&quot;&gt;Wipe DISK&lt;&#x2F;h3&gt;
&lt;p&gt;Wipe existing file systems and partition table on DISK:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gpt destroy $DISK &amp;amp;&amp;amp; gpt show $DISK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;partition-disk&quot;&gt;Partition DISK&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
I typically set the swap partition size equal to the amount of physical RAM to a maximum &lt;code&gt;8g&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Create a GPT partition table on DISK with the following layout:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;Number&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Size&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Type&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Use as&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;1&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;550m&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;efi&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;ESP partition&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;2&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;6g&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;ffs&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Root partition&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;3&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;8g&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;swap&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Encrypted swap partition&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;4&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;-&amp;gt;END&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;cgd&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Encrypted system partition&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Create a new GPT partition table:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gpt create -f $DISK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Create the wedges:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gpt add -l &amp;quot;ESP&amp;quot; -t efi -s 550m $DISK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gpt add -l &amp;quot;root&amp;quot; -t ffs -s 6g $DISK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gpt add -l &amp;quot;swap&amp;quot; -t swap -s 8g $DISK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gpt add -l &amp;quot;syscgd&amp;quot; -t cgd $DISK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gpt show $DISK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;define-wedge-variables&quot;&gt;Define wedge variables&lt;&#x2F;h3&gt;
&lt;p&gt;List wedges:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# dkctl $DISK listwedges&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;dev&#x2F;rld0: 4 wedges:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dk0: ESP, 1126400 blocks at 34, type: msdos&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dk1: root, 12582912 blocks at 1126434, type: ffs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dk2: swap, 16777216 blocks at 13709346, type: swap&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dk3: syscgd, 1923038573 blocks at 30486562, type: cgd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
Your &lt;code&gt;dk[number]&lt;&#x2F;code&gt; numbering may differ from above. Adjust accordingly:&lt;&#x2F;p&gt;
&lt;p&gt;Define variables:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;DK_ESP=&amp;quot;dk0&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;DK_ROOT=&amp;quot;dk1&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;format-and-mount-the-esp-wedge&quot;&gt;Format and mount the ESP wedge&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;newfs_msdos &#x2F;dev&#x2F;r${DK_ESP} &amp;amp;&amp;amp; mount &#x2F;dev&#x2F;${DK_ESP} &#x2F;mnt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;add-efi-boot-entries-to-esp&quot;&gt;Add EFI boot entries to ESP&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mkdir -p &#x2F;mnt&#x2F;EFI&#x2F;boot &amp;amp;&amp;amp; cp -v &#x2F;usr&#x2F;mdec&#x2F;*.efi &#x2F;mnt&#x2F;EFI&#x2F;boot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Unmount wedge:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;umount &#x2F;mnt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;format-and-mount-the-root-wedge&quot;&gt;Format and mount the root wedge&lt;&#x2F;h3&gt;
&lt;p&gt;Format and mount the root wedge with the &lt;code&gt;FFSv2&lt;&#x2F;code&gt; file system with support for extended attributes and access control lists:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;newfs -O 2ea &#x2F;dev&#x2F;r${DK_ROOT} &amp;amp;&amp;amp; mount &#x2F;dev&#x2F;${DK_ROOT} &#x2F;targetroot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;disk-encryption&quot;&gt;Disk Encryption&lt;&#x2F;h2&gt;
&lt;p&gt;NetBSD uses the &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.netbsd.org&#x2F;docs&#x2F;guide&#x2F;en&#x2F;chap-cgd.html&quot;&gt;cryptographic device driver&lt;&#x2F;a&gt; (CGD) to create and manage encrypted devices.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;create-encrypted-device&quot;&gt;Create encrypted device&lt;&#x2F;h3&gt;
&lt;p&gt;Using &lt;code&gt;cgdconfig&lt;&#x2F;code&gt;, a parameters file is generated that stores the encryption type, key length, and a random password salt for the new encrypted device.&lt;&#x2F;p&gt;
&lt;p&gt;There are a few &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.netbsd.org&#x2F;docs&#x2F;guide&#x2F;en&#x2F;chap-cgd.html#chap-cgd-components-ciphers&quot;&gt;different encryption ciphers supported&lt;&#x2F;a&gt;. I choose &lt;code&gt;aes-xts&lt;&#x2F;code&gt; with a 512-bit key:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mkdir -p &#x2F;targetroot&#x2F;etc&#x2F;cgd &amp;amp;&amp;amp; chmod 700 &#x2F;targetroot&#x2F;etc&#x2F;cgd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cgdconfig -g -V disklabel -o &#x2F;targetroot&#x2F;etc&#x2F;cgd&#x2F;syscgd aes-xts 512&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
&lt;code&gt;NAME=syscgd&lt;&#x2F;code&gt; is the label for the CGD wedge created earlier.&lt;&#x2F;p&gt;
&lt;p&gt;Create the encrypted device and assign it a passphrase. This passphrase will be used to open the CGD device at boot:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cgdconfig -V re-enter cgd0 NAME=syscgd &#x2F;targetroot&#x2F;etc&#x2F;cgd&#x2F;syscgd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;create-disklabels&quot;&gt;Create disklabels&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
Disklabels &lt;code&gt;c&lt;&#x2F;code&gt; and &lt;code&gt;d&lt;&#x2F;code&gt; have &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;man.netbsd.org&#x2F;disklabel.5&quot;&gt;special meaning in NetBSD&lt;&#x2F;a&gt; and should not be used.&lt;&#x2F;p&gt;
&lt;p&gt;Within the encrypted device, three disklabels are created:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;Disklabel&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Mountpoint&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Size&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;cgd0a&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&#x2F;var&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;8G&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;cgd0b&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&#x2F;usr&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;48G&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;cgd0e&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&#x2F;home&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;-&amp;gt;END&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Create the labels using &lt;code&gt;disklabel&lt;&#x2F;code&gt; in interactive mode:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# disklabel -Ii cgd0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Enter &amp;#39;?&amp;#39; for help&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Create &lt;code&gt;cgd0a&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;partition&amp;gt;a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Filesystem type [4.2BSD]: &amp;lt;enter&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Start offset (&amp;#39;x&amp;#39; to start after partition &amp;#39;x&amp;#39;) [0c, 0s, 0M]: &amp;lt;enter&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Partition size (&amp;#39;$&amp;#39; for all remaining) [947594c, 1940672512s, 947594M]: 8G&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  a: ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Create &lt;code&gt;cgd0b&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;partition&amp;gt;b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Filesystem type [unused]: 4.2BSD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Start offset (&amp;#39;x&amp;#39; to start after partition &amp;#39;x&amp;#39;) [0c, 0s, 0M]: a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Partition size (&amp;#39;$&amp;#39; for all remaining) [0c, 0s, 0M]: 48G    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  b: ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Create &lt;code&gt;cgd0e&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;partition&amp;gt;e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Filesystem type [unused]: 4.2BSD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Start offset (&amp;#39;x&amp;#39; to start after partition &amp;#39;x&amp;#39;) [0c, 0s, 0M]: b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Partition size (&amp;#39;$&amp;#39; for all remaining) [0c, 0s, 0M]: $&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; e: ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Write the label and quit:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;partition&amp;gt;W&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Label disk [n]?y&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Label written&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;partition&amp;gt;Q&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;verify-encrypted-device&quot;&gt;Verify encrypted device&lt;&#x2F;h3&gt;
&lt;p&gt;Set configuration in target device:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;echo &amp;#39;cgd0 NAME=syscgd &#x2F;etc&#x2F;cgd&#x2F;syscgd&amp;#39; &amp;gt; &#x2F;targetroot&#x2F;etc&#x2F;cgd&#x2F;cgd.conf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Close the CGD device:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cgdconfig -u cgd0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Unlock the CGD device again with the passphrase set earlier:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cgdconfig cgd0 NAME=syscgd &#x2F;targetroot&#x2F;etc&#x2F;cgd&#x2F;syscgd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;cgd0&lt;&#x2F;code&gt; drive should now be open and the disklabel visible:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;disklabel cgd0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;format-and-mount-disklabels&quot;&gt;Format and mount disklabels&lt;&#x2F;h3&gt;
&lt;p&gt;Format:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;newfs -O 2ea cgd0a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;newfs -O 2ea cgd0b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;newfs -O 2ea cgd0e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Mount:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mkdir &#x2F;targetroot&#x2F;var &#x2F;targetroot&#x2F;usr &#x2F;targetroot&#x2F;home&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mount &#x2F;dev&#x2F;cgd0a &#x2F;targetroot&#x2F;var&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mount &#x2F;dev&#x2F;cgd0b &#x2F;targetroot&#x2F;usr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mount &#x2F;dev&#x2F;cgd0e &#x2F;targetroot&#x2F;home&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;installation&quot;&gt;Installation&lt;&#x2F;h2&gt;
&lt;p&gt;The new system is composed of &lt;strong&gt;sets&lt;&#x2F;strong&gt; (collections of packages) installed to the target device. These sets are located in &lt;code&gt;&#x2F;amd64&#x2F;binary&#x2F;sets&lt;&#x2F;code&gt;. Move into that directory:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cd &#x2F;amd64&#x2F;binary&#x2F;sets &amp;amp;&amp;amp; ls&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
Adding flag &lt;code&gt;p&lt;&#x2F;code&gt; to the &lt;code&gt;tar&lt;&#x2F;code&gt; command is important. It ensures that all files preserve their &lt;code&gt;owners&lt;&#x2F;code&gt; and &lt;code&gt;mode&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;At a minimum, you must select a kernel and the &lt;code&gt;base&lt;&#x2F;code&gt; and &lt;code&gt;etc&lt;&#x2F;code&gt; sets. Below are the sets I choose to install for a desktop setup:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# for set in base comp etc games gpufw kern-GENERIC man misc modules rescue tests text xbase xcomp xetc xfont xserver; do&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt; tar -xvzpf $set.tar.xz -C &#x2F;targetroot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt; done&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;configure-the-system&quot;&gt;Configure the System&lt;&#x2F;h2&gt;
&lt;p&gt;Chroot into the freshly installed NetBSD and configure the new OS.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;chroot&quot;&gt;Chroot&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;chroot &#x2F;targetroot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;directories&quot;&gt;Directories&lt;&#x2F;h3&gt;
&lt;p&gt;Create the &lt;code&gt;kern&lt;&#x2F;code&gt; and &lt;code&gt;proc&lt;&#x2F;code&gt; directories:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mkdir kern proc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;devices&quot;&gt;Devices&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cd dev&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sh MAKEDEV all&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;On a previous install, after rebooting the boot process halted with the error message:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;etc&#x2F;defaults&#x2F;rc.conf: cannot create &#x2F;dev&#x2F;null: read-only file system&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;etc&#x2F;rc: cannot create &#x2F;dev&#x2F;null: read-only file system&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Device &lt;code&gt;null&lt;&#x2F;code&gt; shows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# ls -l &#x2F;dev&#x2F;null&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-rw-r--r--  1 root  wheel  0 Aug  6 14:10 &#x2F;dev&#x2F;null&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To avoid this error, remove the existing &lt;code&gt;null&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rm &#x2F;dev&#x2F;null&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Re-create &lt;code&gt;null&lt;&#x2F;code&gt; with &lt;code&gt;mknod&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# mknod -m 0666 -u root -g wheel &#x2F;dev&#x2F;null c 2 2 &amp;amp;&amp;amp; ls -l &#x2F;dev&#x2F;null&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;crw-rw-rw-  1 root  wheel  2, 2 Aug  6 14:12 &#x2F;dev&#x2F;null&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;root-password&quot;&gt;Root password&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;passwd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;superuser&quot;&gt;Superuser&lt;&#x2F;h3&gt;
&lt;p&gt;Create a user account assigned to the &lt;code&gt;wheel&lt;&#x2F;code&gt; and &lt;code&gt;operator&lt;&#x2F;code&gt; groups:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;useradd -G [groups] -m [username]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Example: Create an account for user &lt;code&gt;foo&lt;&#x2F;code&gt; and assign a password:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;useradd -G wheel,operator -m foo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;passwd foo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;userinfo foo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;fstab&quot;&gt;Fstab&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# cat &amp;gt; &#x2F;etc&#x2F;fstab &amp;lt;&amp;lt; EOF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;NAME=root         &#x2F;         ffs     rw,log,noatime  	1 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;NAME=swap         none      swap    sw,dp   		    0 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tmpfs             &#x2F;tmp      tmpfs   rw,-m1777,-sram%25&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;kernfs            &#x2F;kern     kernfs  rw&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ptyfs             &#x2F;dev&#x2F;pts  ptyfs   rw&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;procfs            &#x2F;proc     procfs  rw&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tmpfs             &#x2F;var&#x2F;shm  tmpfs   rw,-m1777,-sram%25&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;dev&#x2F;cgd0a        &#x2F;var      ffs     rw,log,noatime      1 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;dev&#x2F;cgd0b        &#x2F;usr      ffs     rw,log,noatime      1 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;dev&#x2F;cgd0e        &#x2F;home     ffs     rw,log,noatime      1 2 &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;EOF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;startup&quot;&gt;Startup&lt;&#x2F;h3&gt;
&lt;p&gt;Open &lt;code&gt;rc.conf&lt;&#x2F;code&gt; for editing:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;vi &#x2F;etc&#x2F;rc.conf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
In this HOWTO, my hostname was earlier set to &lt;code&gt;foobox.home.arpa&lt;&#x2F;code&gt; during network setup, and my wired interface is &lt;code&gt;wm0&lt;&#x2F;code&gt;. Adjust accordingly:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# If this is not set to YES, the system will drop into single-user mode.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rc_configured=YES&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Add local overrides below.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Wait for CGD to be unlocked before mounting.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;critical_filesystems_local=&amp;quot;OPTIONAL:&#x2F;var OPTIONAL:&#x2F;usr&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dhcpcd=YES&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dhcpcd_flags=&amp;quot;-qM wm0&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hostname=foobox.home.arpa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sshd=YES&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ntpd=YES&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ntpdate=YES&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;wscons=YES&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cgd=YES&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Save changes and exit.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
Any &lt;code&gt;Error: &#x2F;dev&#x2F;ttypX: No such file or directory&lt;&#x2F;code&gt; messages can be safely ignored.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;keyboard&quot;&gt;Keyboard&lt;&#x2F;h3&gt;
&lt;p&gt;A full list of keyboard mappings and variants can be found in &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;man.netbsd.org&#x2F;wskbd.4&quot;&gt;wskbd(4)&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Set &lt;code&gt;encoding [type_of_keyboard]&lt;&#x2F;code&gt; in &lt;code&gt;wscons.conf&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Open file for editing:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;vi &#x2F;etc&#x2F;wscons.conf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Example: I use the non-default &lt;code&gt;colemak&lt;&#x2F;code&gt; keymap:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;encoding us.colemak&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Save changes and exit.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;timezone&quot;&gt;Timezone&lt;&#x2F;h3&gt;
&lt;p&gt;Create a symlink to the appropriate timezone for your &lt;code&gt;localtime&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ln -sf &#x2F;usr&#x2F;share&#x2F;zoneinfo&#x2F;[region&#x2F;&amp;lt;city_or_sub-region] &#x2F;etc&#x2F;localtime&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Example: Set &lt;code&gt;localtime&lt;&#x2F;code&gt; to &lt;code&gt;Canada&#x2F;Eastern&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ln -sf &#x2F;usr&#x2F;share&#x2F;zoneinfo&#x2F;Canada&#x2F;Eastern &#x2F;etc&#x2F;localtime &amp;amp;&amp;amp; date&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;network-interface&quot;&gt;Network interface&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;man.netbsd.org&#x2F;ifconfig.if.5&quot;&gt;ifconfig.if(5)&lt;&#x2F;a&gt; contains the configuration details for each network interface.&lt;&#x2F;p&gt;
&lt;p&gt;Example: Create an interface file for the &lt;code&gt;wm0&lt;&#x2F;code&gt; interface that is assigned an IP address via DHCP:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# cat &amp;gt; &#x2F;etc&#x2F;ifconfig.wm0 &amp;lt;&amp;lt; EOF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;up&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;media autoselect&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;EOF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;terminals&quot;&gt;Terminals&lt;&#x2F;h3&gt;
&lt;p&gt;Set the status of terminals &lt;code&gt;ttyE1-ttyE3&lt;&#x2F;code&gt; in &lt;code&gt;ttys&lt;&#x2F;code&gt; from &lt;code&gt;off&lt;&#x2F;code&gt; to &lt;code&gt;on&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Open file for editing:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;vi &#x2F;etc&#x2F;ttys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is how it should look:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# name  getty                           type    status          comments&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;console &amp;quot;&#x2F;usr&#x2F;libexec&#x2F;getty Pc&amp;quot;         wsvt25  off secure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;constty &amp;quot;&#x2F;usr&#x2F;libexec&#x2F;getty Pc&amp;quot;         wsvt25  on secure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ttyE0   &amp;quot;&#x2F;usr&#x2F;libexec&#x2F;getty Pc&amp;quot;         wsvt25  off secure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ttyE1   &amp;quot;&#x2F;usr&#x2F;libexec&#x2F;getty Pc&amp;quot;         wsvt25  on secure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ttyE2   &amp;quot;&#x2F;usr&#x2F;libexec&#x2F;getty Pc&amp;quot;         wsvt25  on secure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ttyE3   &amp;quot;&#x2F;usr&#x2F;libexec&#x2F;getty Pc&amp;quot;         wsvt25  on secure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Save changes and exit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;finish-up&quot;&gt;Finish Up&lt;&#x2F;h2&gt;
&lt;p&gt;Exit chroot:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;exit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cd &#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Unmount:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;umount &#x2F;targetroot&#x2F;home&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;umount &#x2F;targetroot&#x2F;usr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;umount &#x2F;targetroot&#x2F;var&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;umount &#x2F;targetroot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Close encrypted device:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cgdconfig -u cgd0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Reboot system:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;shutdown -r now&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
When prompted for the passphrase to unlock the encrypted device, keymap is &lt;code&gt;us qwerty&lt;&#x2F;code&gt; regardless of keymap that might have been set in &lt;code&gt;wscons.conf&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;User is prompted for the passphrase to unlock the encrypted &lt;code&gt;syscgd&lt;&#x2F;code&gt; device. Upon success, boot resumes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;NetBSD&#x2F;amd64 (foobox.home.arpa) (constty)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;login: root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Password:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Welcome to NetBSD!&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;To shutdown&#x2F;poweroff the system:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;shutdown -p now&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Next: &lt;a href=&quot;&#x2F;netbsd-after&quot;&gt;After the First Boot&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;resources&quot;&gt;Resources&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;This HOWTO posted by &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;vsis.online&#x2F;&quot;&gt;vsis&lt;&#x2F;a&gt; was crucial in getting my own system configured with encryption: &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;vsis.online&#x2F;posts&#x2F;2024-05-27-uefi-full-disk-encryption&#x2F;&quot;&gt;NetBSD - UEFI installation with Full Disk Encryption&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Alternative approach for disk encryption using a ramdisk on BIOS boot systems: &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.unitedbsd.com&#x2F;d&#x2F;461-netbsd-full-disk-encryption-with-cgd&quot;&gt;NetBSD Full-Disk Encryption with CGD (BIOS&#x2F;GPT)&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;NetBSD INSTALL: &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;ftp.netbsd.org&#x2F;pub&#x2F;NetBSD&#x2F;NetBSD-10.1&#x2F;amd64&#x2F;INSTALL.html&quot;&gt;Installation procedure for NetBSD&#x2F;amd64&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;NetBSD Wiki: &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;wiki.netbsd.org&#x2F;Installation_on_UEFI_systems&#x2F;&quot;&gt;Installing NetBSD on a x86 system with UEFI&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;NetBSD Guide: &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.netbsd.org&#x2F;docs&#x2F;guide&#x2F;en&#x2F;chap-cgd.html&quot;&gt;Chapter 14. The cryptographic device driver (CGD)&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Suggested tools for inspecting disks: &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.unitedbsd.com&#x2F;d&#x2F;1157-disk-management-from-installation-iso&quot;&gt;Disk management from Installation ISO&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Skipping sysinst install for a more “hands-on” approach: &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.unitedbsd.com&#x2F;d&#x2F;771-netbsd-desktop-part-1-manual-netbsd-installation-on-gptuefi&quot;&gt;Manual NetBSD install on GPT&#x2F;UEFI&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Swap encryption is now automatic using the &lt;code&gt;vm.swap_encrypt=1&lt;&#x2F;code&gt; &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;man.netbsd.org&#x2F;sysctl.8&quot;&gt;sysctl(8)&lt;&#x2F;a&gt; variable: &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.netbsd.org&#x2F;releases&#x2F;formal-10&#x2F;NetBSD-10.0.html&quot;&gt;Announcing NetBSD 10.0&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p class=&quot;mastodon&quot;&gt;
You can like, share, or comment on this post &lt;a href=&quot;https:&#x2F;&#x2F;fosstodon.org&#x2F;@dwarmstrong&#x2F;117049190837209000&quot; target=&quot;_blank&quot;&gt;on the Fediverse&lt;&#x2F;a&gt; &amp;#128172
&lt;&#x2F;p&gt;
</description>
    </item>
    <item>
      <title>Set Up a Basic Firewall on FreeBSD</title>
      <pubDate>Sat, 15 Aug 2026 00:00:00 +0000</pubDate>
      <link>https://www.dwarmstrong.org/freebsd-pf/</link>
      <guid>https://www.dwarmstrong.org/freebsd-pf/</guid>
      <description>&lt;p&gt;I use &lt;strong&gt;Packet Filter (PF)&lt;&#x2F;strong&gt; to set up a basic firewall on FreeBSD. To start, the only service I’m running that requires inbound access is SSH. &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.sshguard.net&#x2F;&quot;&gt;SSHGuard&lt;&#x2F;a&gt; is added for an additional layer of security.&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;freebsd-pf&#x2F;#start-here&quot;&gt;Start Here&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;freebsd-pf&#x2F;#enable-pf&quot;&gt;Enable PF&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;freebsd-pf&#x2F;#sshguard&quot;&gt;SSHGuard&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;freebsd-pf&#x2F;#icmp&quot;&gt;ICMP&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;freebsd-pf&#x2F;#final-config&quot;&gt;Final Config&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;www.dwarmstrong.org&#x2F;freebsd-pf&#x2F;#resources&quot;&gt;Resources&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;hr &#x2F;&gt;
&lt;h2 id=&quot;start-here&quot;&gt;Start Here&lt;&#x2F;h2&gt;
&lt;p&gt;PF requires a &lt;strong&gt;ruleset&lt;&#x2F;strong&gt; configuration file to operate. Example rulesets are found in &lt;code&gt;&#x2F;usr&#x2F;share&#x2F;examples&#x2F;pf&#x2F;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;I implement a basic ruleset by creating the &lt;code&gt;&#x2F;etc&#x2F;pf.conf&lt;&#x2F;code&gt; file with:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tcp_services = &amp;quot;{ ssh }&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;scrub in all&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block in all&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pass out all keep state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pass in proto tcp to port $tcp_services&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This blocks all inbound traffic by default, with the exception of &lt;code&gt;ssh&lt;&#x2F;code&gt;, and allows all outbound traffic to pass.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;enable-pf&quot;&gt;Enable PF&lt;&#x2F;h2&gt;
&lt;p&gt;Set the &lt;code&gt;pf&lt;&#x2F;code&gt; kernel module to be loaded by adding to &lt;code&gt;&#x2F;etc&#x2F;rc.conf&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;doas sysrc pf_enable=YES&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Add a line which specifies the path to the ruleset file:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;doas sysrc pf_rules=&#x2F;etc&#x2F;pf.conf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Enable logging support, provided by &lt;code&gt;pflog(4)&lt;&#x2F;code&gt;, by adding:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;doas sysrc pflog_enable=YES&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Reboot.&lt;&#x2F;p&gt;
&lt;p&gt;SSH connections are allowed in. Everything else is blocked. Try running &lt;code&gt;ping&lt;&#x2F;code&gt; directed at the firewalled FreeBSD machine and observe that all packets are dropped.&lt;&#x2F;p&gt;
&lt;p&gt;Use the &lt;code&gt;pfctl(8)&lt;&#x2F;code&gt; command to manage &lt;code&gt;pf&lt;&#x2F;code&gt;. Example: Check &lt;code&gt;&#x2F;etc&#x2F;pf.conf&lt;&#x2F;code&gt; for errors, but do not load ruleset:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&amp;gt; doas pfctl -nvf &#x2F;etc&#x2F;pf.conf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tcp_services = &amp;quot;{ ssh }&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;scrub in all fragment reassemble&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block drop in all&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pass out all flags S&#x2F;SA keep state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pass in proto tcp from any to any port = ssh flags S&#x2F;SA keep state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To view a dynamic snapshot of traffic that passes through the firewall, install the &lt;code&gt;pftop(8)&lt;&#x2F;code&gt; package:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;doas pkg install pftop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;sshguard&quot;&gt;SSHGuard&lt;&#x2F;h2&gt;
&lt;p&gt;Install &lt;code&gt;sshguard&lt;&#x2F;code&gt; to block bad &lt;code&gt;ssh&lt;&#x2F;code&gt; login attempts:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;doas pkg install sshguard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Add to &lt;code&gt;rc.conf&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;doas sysrc sshguard_enable=YES&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Set the appropriate firewall &lt;code&gt;BACKEND&lt;&#x2F;code&gt; for &lt;code&gt;sshguard&lt;&#x2F;code&gt; by modifying &lt;code&gt;&#x2F;usr&#x2F;local&#x2F;etc&#x2F;sshguard.conf&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Full path to backend executable (required, no default)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;BACKEND=&amp;quot;&#x2F;usr&#x2F;local&#x2F;libexec&#x2F;sshg-fw-pf&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;SSHGuard works alongside &lt;code&gt;pf&lt;&#x2F;code&gt; by adding attackers to the table &lt;code&gt;&amp;lt;sshguard&amp;gt;&lt;&#x2F;code&gt;. Create this table and block attackers by adding the following lines to the evolving &lt;code&gt;&#x2F;etc&#x2F;pf.conf&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;table &amp;lt;sshguard&amp;gt; persist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block in proto tcp from &amp;lt;sshguard&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
Ensure the line &lt;code&gt;table &amp;lt;sshguard&amp;gt; persist&lt;&#x2F;code&gt; comes before filtering rules to prevent syntax errors.&lt;&#x2F;p&gt;
&lt;p&gt;See &lt;code&gt;sshguard-setup(7)&lt;&#x2F;code&gt; for more details.&lt;&#x2F;p&gt;
&lt;p&gt;Reload the rules:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;doas pfctl -f &#x2F;etc&#x2F;pf.conf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Start the service:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;doas service sshguard start&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To inspect the contents of the block table, run:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;doas pfctl -t sshguard -T show&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;icmp&quot;&gt;ICMP&lt;&#x2F;h2&gt;
&lt;p&gt;Blocking &lt;code&gt;ping&lt;&#x2F;code&gt; can make troubleshooting network issues more difficult. Let’s give it a &lt;code&gt;pass&lt;&#x2F;code&gt;, and allow destination unreachable messages. Add to &lt;code&gt;&#x2F;etc&#x2F;pf.conf&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;icmp_types = &amp;quot;{ echoreq, unreach }&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pass in inet proto icmp icmp-type $icmp_types&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;final-config&quot;&gt;Final Config&lt;&#x2F;h2&gt;
&lt;p&gt;The complete &lt;code&gt;&#x2F;etc&#x2F;pf.conf&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tcp_services = &amp;quot;{ ssh }&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# &amp;#39;echoreq&amp;#39; allows inbound ping requests, and &amp;#39;unreach&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# allows destination unreachable messages&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;icmp_types = &amp;quot;{ echoreq, unreach }&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# table added before filtering rules to prevent syntax errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;table &amp;lt;sshguard&amp;gt; persist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;scrub in all&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block in all&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block in proto tcp from &amp;lt;sshguard&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pass out all keep state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pass in inet proto icmp icmp-type $icmp_types&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pass in proto tcp to port $tcp_services&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Reload the rules:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;doas pfctl -f &#x2F;etc&#x2F;pf.conf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;resources&quot;&gt;Resources&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;docs.freebsd.org&#x2F;en&#x2F;books&#x2F;handbook&#x2F;firewalls&#x2F;index.html#firewalls-pf&quot;&gt;FreeBSD Handbook: PF&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=W3LLuCb8VAs&quot;&gt;YouTube: Setting up a basic firewall with pf on FreeBSD&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.sshguard.net&#x2F;docs&#x2F;sshguard-setup.html&quot;&gt;SSHGuard Manual: sshguard-setup&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;&#x2F;freebsd-ssh-keys&#x2F;&quot;&gt;SSH key-based authentication&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p class=&quot;mastodon&quot;&gt;
You can like, share, or comment on this post &lt;a href=&quot;https:&#x2F;&#x2F;fosstodon.org&#x2F;@dwarmstrong&#x2F;117099612121367686&quot; target=&quot;_blank&quot;&gt;on the Fediverse&lt;&#x2F;a&gt; &amp;#128172
&lt;&#x2F;p&gt;
</description>
    </item>
</channel>
</rss>
