GNU/Linux {docs}

OpenBSD

doas

doas is like sudo in Linux. In order to add a user to doas, we must allow keepenv into the :wheel group:

# cp /etc/examples/doas.conf /etc

In order to make doas more persistent so we don't need to type the root password everytime, we can edit /etc/doas.conf so it looks like this:

permit persist keepenv :wheel

WiFi configuration

  1. Find out your wireless interface:
ifconfig

Result: rtwn0

  1. Fire up the device
doas ifconfig rtwn0 up
  1. Scan wireless connections in order to find your SSID:
ifconfig rtwn0 scan | less
  1. Edit /etc/hostname.rtwn0
nwid [SSID] wpakey [PASSWORD]
dhcp
  1. Reboot

Note: If your OpenBSD installation does not recognize your wireless interface, run:

fw_update

Patches and upgrades

  • syspatch: Patch the OS
  • sysupgrade: Upgrade the system (not the packages)

Package managament

  • pkg_add: Install package
  • pkg_add -u: Upgrade all packages
  • pkg_add -u <package>: Upgrade <package>
  • pkg_delete: Remove package
  • pkg_delete -a: Remove unused dependencies
  • pkg_info: List installed packages
  • pkg_info <package>: Detailed info of <package> (installed or not)
  • pkg_info -Q <name>: List all packages using that name (installed or not)

Total upgrade

doas sysupgrade
doas pkg_add -u
doas syspatch

Commonly used commands

ksh, sysctl, systat, usbdevs, pcidump, disklabel, sysctl hw.disknames, vmstat

rc (8)

Split up into several parts:

  • /etc/rc - Startup command script
  • /etc/rc.conf - System daemon configuration database (don’t touch)
  • /etc/rc.conf.local - System local configuration
  • /etc/rc.d - Location of rc.d(8) scripts

rc.conf[.local]

  • daemon_flags=<args>
    • apmd_flags=NO - Daemon disabled
    • apmd_flags= - Daemon enabled
    • apmd_flags=-A - Daemons enabled with special flags
  • Special services (pf, ipsec, etc.) only have a YES/NO option
    • pf_enable=YES
  • pkg_scripts - Services that have to startup and shutdown in order
    • Example: pkg_scripts=messagebus cupsd

rcctl (8)

  • rcctl start | stop | restart | check
  • rcctl enable | disable | get | set | order | getdef
  • rcctl ls all | ls failed | ls on | ls off | ls started | ls stopped

Enable Xenodm (Display Manager)

rcctl enable xenodm
rcctl start xenodm

Mount Pendrive

  1. Find out pendrive device name:

doas sysctl hw.disknames

  1. Find out information about the pendrive device:

disklabel sd1

  1. Mounting & unmounting device:
doas mkdir /mnt/pen
doas mount /dev/sd1i /mnt/pen
doas umount /mnt/pen

Change Shell

Change Shell to BASH for a user:

doas chsh -s /usr/local/bin/bash [USER]

If you want to change to shell for the root, just omit the [USER] parameter

Shells available in OpenBSD:

bash, csh, git-shell, ksh, nologin, sh

Spanish characters

echo "export LANG=en_US.UTF-8" >> .profile

DWM

You can automatically install DWM and suckless programs following the instructions at my github repository

LXQt

  1. Install LXQt and Firefox
`$ doas pkg_add lxqt`
  1. Start LXQt automatically
  • Create .xsession file
  • Edit .xsession file and add startlxqt

List of OpenBSD programs and tools:

Programs

OpenSSH, LibreSSL, openrsync, pf

Tools

signify, mandoc, sndio, doas, httpd, relayd, vmm/vmd, switchd, unwind, xenocara, acme-client

Editors

ed, vi, mg

User management

adduser, chpass, useradd, usermod, userinfo, userdel

Group management

groupadd, groupmod, groupinfo, groupdel

Man pages

  • apropos
  • man afterboot
  • man hier
  • man <#> intro
    • Section 1: General commands
    • Section 2: System calls
    • Section 3: C library functions
    • Section 4: Device drivers
    • Section 5: File formats
    • Section 6: Games
    • Section 7: Miscellaneous
    • Section 8: System management
    • Section 9: Kernel development

Turn off the computer

doas halt -p