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
- Find out your wireless interface:
ifconfig
Result: rtwn0
- Fire up the device
doas ifconfig rtwn0 up
- Scan wireless connections in order to find your SSID:
ifconfig rtwn0 scan | less
- Edit
/etc/hostname.rtwn0
nwid [SSID] wpakey [PASSWORD]dhcp
- 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 sysupgradedoas pkg_add -udoas 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 xenodmrcctl start xenodm
Mount Pendrive
- Find out pendrive device name:
doas sysctl hw.disknames
- Find out information about the pendrive device:
disklabel sd1
- Mounting & unmounting device:
doas mkdir /mnt/pendoas mount /dev/sd1i /mnt/pendoas 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
- Install LXQt and Firefox
`$ doas pkg_add lxqt`
- Start LXQt automatically
- Create
.xsessionfile - Edit
.xsessionfile and addstartlxqt
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