OBSD CHEATSHEET
TODO: sysctl.conf
CHANGING NETWORK PARAMETERS
Modifying your network setup is quite simple. OpenBSD configures the cards installed on your system in the /etc/hostname.$interface files, and are simply shorthand notations for ifconfig, which does the actual interface initialization.
WIRED EXAMPLE
-
DHCP
dhcp inet6 autoconf
-
Manual assignment
inet $IP $NETMASK
WIRELESS EXAMPLE
-
DHCP
nwid $SSID wpakey $WPA_PASSPHRASE dhcp inet6 autoconf
-
MANUAL ASSIGNMENT
nwid $SSID wpakey $WPA_PASSPHRASE inet $IP $NETMASK
doas - OPENBSD'S BETTER SUDO
As root edit /etc/doas.conf and add one entry per line, a parameter to enable sudo-like behavior. There are no defaults as with sudo, but there is a stock file in /etc/examples that can be copied over as a starting spot if desired. Otherwise, you can, like most OBSD users, just start from scratch. Here are some examples. Refer to the manpage for full details.
-
Full on god mode
permit keepenv nopass USER
-
Allow group to use pkg_add
permit keepenv :GROUPNAME cmd pkg_add
-
Allow schotty to reboot
permit schotty cmd reboot
FIX FIRMWARE ISSUES
As root and connected to the internet to pull in updated firmware:
fw_update -v
PACKAGE MANAGEMENT
The first time any pkg command is run, you will have a lag between invokation and any output as the database is sucked in.
-
Installing a package
pkg_add -i $PKGNAME $PKGNAME2 ...
-
Query a package
pkg_info -Q $NAME
-
Full information on a package
pkg_info -D $PKGNAME
USEFUL PACKAGES
midori
xfce
gnuwatch
git
epiphany
vim
htop
RCCTL - DAEMON MANAGEMENT
rcctl is the utility most akin to the old sysvinit system on GNU/Linux, but as most things OpenBSD, simpler and more powerful in some regards. rcctl allows for starting, stopping, enabling on boot, and disabling on boot any daemon installed. The latter two options will appropriately modify /etc/rc.conf.local to reflect your change(s).
A simple example is
-
Starting apmd
rcctl start apmd
-
Enabling apmd on boot and set flag -A
rcctl enable apmd rcctl set apmd flags -A
-
Stopping apmd
rcctl stop apmd
-
Disabling apmd on boot
rcctl disable apmd
SWAPFILE CREATION AND USAGE
Here is a quick 4G swapfile creation (change step 1 count to be the size in MB for your needs). Execute, obviously, as root or with escalated permissions (doas or su). Add to fstab an entry if you want this to be enabled on boot.
- dd if=/dev/zero of=/swap.bin bs=1M count=4096
- chmod 0600 /swap.bin
- swapctl -a /swap.bin
- swapctl -l
SYSTEM UPDATES
BSD does not work like GNU/Linux -- the base is NOT broken up into multiple packages, but rather the base itself is one package. Patches to any base component can be applied using the following command (as root, of course -- use doas or su - to escalate privileges):
syspatch