<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/default.xsl"?>
<fr:tree xmlns:fr="http://www.forester-notes.org" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:xml="http://www.w3.org/XML/1998/namespace" root="false" base-url="/">
  <fr:frontmatter>
    <fr:authors>
      <fr:author>
        <fr:link href="/aram/" title="Aram Hăvărneanu" uri="https://xw.is/aram/" display-uri="aram" type="local">Aram Hăvărneanu</fr:link>
      </fr:author>
    </fr:authors>
    <fr:date>
      <fr:year>2018</fr:year>
      <fr:month>6</fr:month>
      <fr:day>7</fr:day>
    </fr:date>
    <fr:date>
      <fr:year>2025</fr:year>
      <fr:month>7</fr:month>
      <fr:day>15</fr:day>
    </fr:date>
    <fr:uri>https://xw.is/001A/</fr:uri>
    <fr:display-uri>001A</fr:display-uri>
    <fr:route>/001A/</fr:route>
    <fr:title text="FreeBSD › FreeBSD Post Install Steps"><fr:link href="/freebsd-index/" title="FreeBSD" uri="https://xw.is/freebsd-index/" display-uri="freebsd-index" type="local">FreeBSD</fr:link> › <fr:link href="/freebsd/" title="FreeBSD" uri="https://xw.is/freebsd/" display-uri="freebsd" type="local">FreeBSD</fr:link> Post Install Steps</fr:title>
  </fr:frontmatter>
  <fr:mainmatter>
    <fr:tree show-metadata="false">
      <fr:frontmatter>
        <fr:authors>
          <fr:author>
            <fr:link href="/aram/" title="Aram Hăvărneanu" uri="https://xw.is/aram/" display-uri="aram" type="local">Aram Hăvărneanu</fr:link>
          </fr:author>
        </fr:authors>
        <fr:date>
          <fr:year>2018</fr:year>
          <fr:month>6</fr:month>
          <fr:day>7</fr:day>
        </fr:date>
        <fr:date>
          <fr:year>2025</fr:year>
          <fr:month>7</fr:month>
          <fr:day>15</fr:day>
        </fr:date>
        <fr:title text="Introduction">Introduction</fr:title>
      </fr:frontmatter>
      <fr:mainmatter>
        <html:p>Everything on this page needs to be done as root unless otherwise specified, so <fr:link href="https://man.freebsd.org/cgi/man.cgi?su(1)" type="external">su(1)</fr:link> to root.</html:p>
        <html:pre>su -</html:pre>
      </fr:mainmatter>
    </fr:tree>
    <fr:tree show-metadata="false">
      <fr:frontmatter>
        <fr:authors>
          <fr:author>
            <fr:link href="/aram/" title="Aram Hăvărneanu" uri="https://xw.is/aram/" display-uri="aram" type="local">Aram Hăvărneanu</fr:link>
          </fr:author>
        </fr:authors>
        <fr:date>
          <fr:year>2018</fr:year>
          <fr:month>6</fr:month>
          <fr:day>7</fr:day>
        </fr:date>
        <fr:date>
          <fr:year>2025</fr:year>
          <fr:month>7</fr:month>
          <fr:day>15</fr:day>
        </fr:date>
        <fr:title text="Set the hostname">Set the hostname</fr:title>
      </fr:frontmatter>
      <fr:mainmatter>
        <html:pre>echo 'hostname="phoenix.xw.is"' &gt;&gt; /etc/rc.conf</html:pre>
      </fr:mainmatter>
    </fr:tree>
    <fr:tree show-metadata="false">
      <fr:frontmatter>
        <fr:authors>
          <fr:author>
            <fr:link href="/aram/" title="Aram Hăvărneanu" uri="https://xw.is/aram/" display-uri="aram" type="local">Aram Hăvărneanu</fr:link>
          </fr:author>
        </fr:authors>
        <fr:date>
          <fr:year>2018</fr:year>
          <fr:month>6</fr:month>
          <fr:day>7</fr:day>
        </fr:date>
        <fr:date>
          <fr:year>2025</fr:year>
          <fr:month>7</fr:month>
          <fr:day>15</fr:day>
        </fr:date>
        <fr:title text="Update the software">Update the software</fr:title>
      </fr:frontmatter>
      <fr:mainmatter>
        <html:pre>freebsd-update fetch
freebsd-update install</html:pre>
      </fr:mainmatter>
    </fr:tree>
    <fr:tree show-metadata="false">
      <fr:frontmatter>
        <fr:authors>
          <fr:author>
            <fr:link href="/aram/" title="Aram Hăvărneanu" uri="https://xw.is/aram/" display-uri="aram" type="local">Aram Hăvărneanu</fr:link>
          </fr:author>
        </fr:authors>
        <fr:date>
          <fr:year>2018</fr:year>
          <fr:month>6</fr:month>
          <fr:day>7</fr:day>
        </fr:date>
        <fr:date>
          <fr:year>2025</fr:year>
          <fr:month>7</fr:month>
          <fr:day>15</fr:day>
        </fr:date>
        <fr:title text="Install basic software">Install basic software</fr:title>
      </fr:frontmatter>
      <fr:mainmatter>
        <html:pre>pkg install -y bash sudo rsync tmux</html:pre>
        <fr:tree show-metadata="false">
          <fr:frontmatter>
            <fr:authors>
              <fr:author>
                <fr:link href="/aram/" title="Aram Hăvărneanu" uri="https://xw.is/aram/" display-uri="aram" type="local">Aram Hăvărneanu</fr:link>
              </fr:author>
            </fr:authors>
            <fr:date>
              <fr:year>2018</fr:year>
              <fr:month>6</fr:month>
              <fr:day>7</fr:day>
            </fr:date>
            <fr:date>
              <fr:year>2025</fr:year>
              <fr:month>7</fr:month>
              <fr:day>15</fr:day>
            </fr:date>
            <fr:title text="ZFS">ZFS</fr:title>
          </fr:frontmatter>
          <fr:mainmatter>
            <html:p>If you don't have ZFS root, for example in a pre-made cloud computing image, you might want to create a separate ZFS pool.</html:p>
            <html:pre>echo 'zfs_enable="YES"' &gt;&gt;/etc/rc.conf
service zfs start
zpool create -m /tank tank xbd1
zfs set compression=on tank</html:pre>
          </fr:mainmatter>
        </fr:tree>
      </fr:mainmatter>
    </fr:tree>
    <fr:tree show-metadata="false">
      <fr:frontmatter>
        <fr:authors>
          <fr:author>
            <fr:link href="/aram/" title="Aram Hăvărneanu" uri="https://xw.is/aram/" display-uri="aram" type="local">Aram Hăvărneanu</fr:link>
          </fr:author>
        </fr:authors>
        <fr:date>
          <fr:year>2018</fr:year>
          <fr:month>6</fr:month>
          <fr:day>7</fr:day>
        </fr:date>
        <fr:date>
          <fr:year>2025</fr:year>
          <fr:month>7</fr:month>
          <fr:day>15</fr:day>
        </fr:date>
        <fr:title text="Create a user">Create a user</fr:title>
      </fr:frontmatter>
      <fr:mainmatter>
        <html:p>Create a user with a random password that can then do passwordless <fr:link href="https://www.sudo.ws/docs/man/1.8.15/sudo.man" type="external">sudo(8)</fr:link>:</html:p>
        <html:pre>pw useradd -n aram -c 'Aram Hăvărneanu' -g staff -G wheel -m -s /usr/local/bin/bash -L staff -w random</html:pre>
        <html:p>Enable passwordless sudo for the staff group:</html:p>
        <html:pre><![CDATA[echo '%staff ALL=(ALL) NOPASSWD:ALL' > /usr/local/etc/sudoers.d/91-staff-no-password]]></html:pre>
        <fr:tree show-metadata="false">
          <fr:frontmatter>
            <fr:authors>
              <fr:author>
                <fr:link href="/aram/" title="Aram Hăvărneanu" uri="https://xw.is/aram/" display-uri="aram" type="local">Aram Hăvărneanu</fr:link>
              </fr:author>
            </fr:authors>
            <fr:date>
              <fr:year>2018</fr:year>
              <fr:month>6</fr:month>
              <fr:day>7</fr:day>
            </fr:date>
            <fr:date>
              <fr:year>2025</fr:year>
              <fr:month>7</fr:month>
              <fr:day>15</fr:day>
            </fr:date>
            <fr:title text="SSH">SSH</fr:title>
          </fr:frontmatter>
          <fr:mainmatter><html:p>For <fr:link href="/ssh.1" title="ssh(1)" uri="https://xw.is/ssh.1" display-uri="ssh.1" type="local">ssh(1)</fr:link> access, first use <fr:link href="https://man.freebsd.org/cgi/man.cgi?su(1)" type="external">su(1)</fr:link> to switch from root to the user:</html:p><html:pre>su - aram</html:pre><html:p>And then populate the <fr:link href="/ssh-keys/" title="OpenSSH › Public SSH Keys" uri="https://xw.is/ssh-keys/" display-uri="ssh-keys" type="local">ssh keys</fr:link>:</html:p>
  <html:pre>
mkdir -p $HOME/.ssh
chmod 700 $HOME/.ssh
cat &lt;&lt;EOF &gt;&gt;$HOME/.ssh/authorized_keys
<![CDATA[ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBHRJsbKlE9QWIQnC1YQPHV8C6cIx32Fjju7VQaKI67TPPm+FySrbJPsM6j4zm9IobTCQ0YOtVmlvXYlRtKdHm0I= pkcs11:id=%62%31%39%32%66%32%33%31%32%66%65%36%66%33%64%37;token=ssh;manufacturer=STMicro;serial=0000000000000000%0D%04?module-path=/usr/lib64/pkcs11/libtpm2_pkcs11.so aram@silverleaf.local
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHwq6SeyHhRRtiMmsBABHYgwqaOwwgBZEMgrRfoSpvzz aram@horizon.local
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMRc0UWKrFpCv/EOUo2jpEQt+C/pa0tc1rUWKgjbKTp7 aram@edengate.local
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPsg+utDc9GRb/n91r0j5vFsn+gVYPawpEbaNCuIhYmE aram@z800.mgk.ro]]>
EOF
chmod 644 $HOME/.ssh/authorized_keys
sort -u -o $HOME/.ssh/authorized_keys $HOME/.ssh/authorized_keys</html:pre>
</fr:mainmatter>
        </fr:tree>
      </fr:mainmatter>
    </fr:tree>
  </fr:mainmatter>
  <fr:backmatter>
    <fr:tree show-metadata="false" hidden-when-empty="true">
      <fr:frontmatter>
        <fr:authors />
        <fr:title text="References">References</fr:title>
      </fr:frontmatter>
      <fr:mainmatter />
    </fr:tree>
    <fr:tree show-metadata="false" hidden-when-empty="true">
      <fr:frontmatter>
        <fr:authors />
        <fr:title text="Context">Context</fr:title>
      </fr:frontmatter>
      <fr:mainmatter />
    </fr:tree>
    <fr:tree show-metadata="false" hidden-when-empty="true">
      <fr:frontmatter>
        <fr:authors />
        <fr:title text="Backlinks">Backlinks</fr:title>
      </fr:frontmatter>
      <fr:mainmatter />
    </fr:tree>
    <fr:tree show-metadata="false" hidden-when-empty="true">
      <fr:frontmatter>
        <fr:authors />
        <fr:title text="Related">Related</fr:title>
      </fr:frontmatter>
      <fr:mainmatter>
        <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
          <fr:frontmatter>
            <fr:authors />
            <fr:uri>https://xw.is/freebsd/</fr:uri>
            <fr:display-uri>freebsd</fr:display-uri>
            <fr:route>/freebsd/</fr:route>
            <fr:title text="FreeBSD">FreeBSD</fr:title>
            <fr:taxon>Software</fr:taxon>
            <fr:meta name="external">https://www.freebsd.org</fr:meta>
          </fr:frontmatter>
          <fr:mainmatter>
            <html:p>Free-software Unix-like operating system descended from the Berkeley Software Distribution (BSD).</html:p>
          </fr:mainmatter>
        </fr:tree>
        <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
          <fr:frontmatter>
            <fr:authors />
            <fr:uri>https://xw.is/ssh.1</fr:uri>
            <fr:display-uri>ssh.1</fr:display-uri>
            <fr:route>/ssh.1</fr:route>
            <fr:title text="ssh(1)">ssh(1)</fr:title>
            <fr:taxon>Manual</fr:taxon>
            <fr:meta name="external">https://man.openbsd.org/ssh.1</fr:meta>
          </fr:frontmatter>
          <fr:mainmatter>
            <html:p>OpenSSH remote login client.</html:p>
          </fr:mainmatter>
        </fr:tree>
        <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
          <fr:frontmatter>
            <fr:authors>
              <fr:author>
                <fr:link href="/aram/" title="Aram Hăvărneanu" uri="https://xw.is/aram/" display-uri="aram" type="local">Aram Hăvărneanu</fr:link>
              </fr:author>
            </fr:authors>
            <fr:date>
              <fr:year>2025</fr:year>
              <fr:month>7</fr:month>
              <fr:day>15</fr:day>
            </fr:date>
            <fr:uri>https://xw.is/ssh-keys/</fr:uri>
            <fr:display-uri>ssh-keys</fr:display-uri>
            <fr:route>/ssh-keys/</fr:route>
            <fr:title text="OpenSSH › Public SSH Keys"><fr:link href="/ssh-index/" title="OpenSSH" uri="https://xw.is/ssh-index/" display-uri="ssh-index" type="local">OpenSSH</fr:link> › Public SSH Keys</fr:title>
          </fr:frontmatter>
          <fr:mainmatter>
            <fr:tree show-metadata="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="/aram/" title="Aram Hăvărneanu" uri="https://xw.is/aram/" display-uri="aram" type="local">Aram Hăvărneanu</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>7</fr:month>
                  <fr:day>15</fr:day>
                </fr:date>
                <fr:title text="SSH Keys">SSH Keys</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <fr:tree show-metadata="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="/aram/" title="Aram Hăvărneanu" uri="https://xw.is/aram/" display-uri="aram" type="local">Aram Hăvărneanu</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>7</fr:month>
                      <fr:day>15</fr:day>
                    </fr:date>
                    <fr:title text="Authentication">Authentication</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter><html:p>These are the public SSH keys that I use for authentication:</html:p>
  <html:pre><![CDATA[ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBHRJsbKlE9QWIQnC1YQPHV8C6cIx32Fjju7VQaKI67TPPm+FySrbJPsM6j4zm9IobTCQ0YOtVmlvXYlRtKdHm0I= pkcs11:id=%62%31%39%32%66%32%33%31%32%66%65%36%66%33%64%37;token=ssh;manufacturer=STMicro;serial=0000000000000000%0D%04?module-path=/usr/lib64/pkcs11/libtpm2_pkcs11.so aram@silverleaf.local
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHwq6SeyHhRRtiMmsBABHYgwqaOwwgBZEMgrRfoSpvzz aram@horizon.local
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMRc0UWKrFpCv/EOUo2jpEQt+C/pa0tc1rUWKgjbKTp7 aram@edengate.local
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPsg+utDc9GRb/n91r0j5vFsn+gVYPawpEbaNCuIhYmE aram@z800.mgk.ro]]></html:pre>
</fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="/aram/" title="Aram Hăvărneanu" uri="https://xw.is/aram/" display-uri="aram" type="local">Aram Hăvărneanu</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>7</fr:month>
                      <fr:day>15</fr:day>
                    </fr:date>
                    <fr:title text="Signing">Signing</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>These are the public SSH keys (in <fr:link href="https://man.openbsd.org/ssh-keygen.1ALLOWED_SIGNERS" type="external"><html:code>allowed_signers</html:code></fr:link> format) that I use for <fr:link href="https://man.openbsd.org/ssh-keygen.1" type="external">signing</fr:link>:</html:p>
                    <html:pre>aram@mgk.ro ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMRc0UWKrFpCv/EOUo2jpEQt+C/pa0tc1rUWKgjbKTp7 aram@edengate.local</html:pre>
                  </fr:mainmatter>
                </fr:tree>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="/aram/" title="Aram Hăvărneanu" uri="https://xw.is/aram/" display-uri="aram" type="local">Aram Hăvărneanu</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>7</fr:month>
                  <fr:day>15</fr:day>
                </fr:date>
                <fr:title text="Install">Install</fr:title>
              </fr:frontmatter>
              <fr:mainmatter><html:p>Run the following commands to populate <html:code>~/.ssh/authorized_keys</html:code> (see <fr:link href="/ssh.1" title="ssh(1)" uri="https://xw.is/ssh.1" display-uri="ssh.1" type="local">ssh(1)</fr:link>), creating it with necessary permissions if required:</html:p>
  <html:pre>
mkdir -p $HOME/.ssh
chmod 700 $HOME/.ssh
cat &lt;&lt;EOF &gt;&gt;$HOME/.ssh/authorized_keys
<![CDATA[ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBHRJsbKlE9QWIQnC1YQPHV8C6cIx32Fjju7VQaKI67TPPm+FySrbJPsM6j4zm9IobTCQ0YOtVmlvXYlRtKdHm0I= pkcs11:id=%62%31%39%32%66%32%33%31%32%66%65%36%66%33%64%37;token=ssh;manufacturer=STMicro;serial=0000000000000000%0D%04?module-path=/usr/lib64/pkcs11/libtpm2_pkcs11.so aram@silverleaf.local
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHwq6SeyHhRRtiMmsBABHYgwqaOwwgBZEMgrRfoSpvzz aram@horizon.local
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMRc0UWKrFpCv/EOUo2jpEQt+C/pa0tc1rUWKgjbKTp7 aram@edengate.local
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPsg+utDc9GRb/n91r0j5vFsn+gVYPawpEbaNCuIhYmE aram@z800.mgk.ro]]>
EOF
chmod 644 $HOME/.ssh/authorized_keys
sort -u -o $HOME/.ssh/authorized_keys $HOME/.ssh/authorized_keys</html:pre>
<html:p>These commands are idempotent and will preserve existing keys.</html:p></fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="/aram/" title="Aram Hăvărneanu" uri="https://xw.is/aram/" display-uri="aram" type="local">Aram Hăvărneanu</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>7</fr:month>
                  <fr:day>15</fr:day>
                </fr:date>
                <fr:title text="Macros">Macros</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>This page exports the <html:code><![CDATA[\ssh-keys]]></html:code> and <html:code><![CDATA[\ssh-keys-install]]></html:code> macros. To use them from other pages import this page with <html:code><![CDATA[\import{ssh-keys}]]></html:code>.</html:p>
              </fr:mainmatter>
            </fr:tree>
          </fr:mainmatter>
        </fr:tree>
      </fr:mainmatter>
    </fr:tree>
    <fr:tree show-metadata="false" hidden-when-empty="true">
      <fr:frontmatter>
        <fr:authors />
        <fr:title text="Contributions">Contributions</fr:title>
      </fr:frontmatter>
      <fr:mainmatter />
    </fr:tree>
  </fr:backmatter>
</fr:tree>
