OpenBSD Handbook

    Theme
    • Part I. Install & Configure
      • Introduction to OpenBSD
      • Installing OpenBSD
      • The X Window System
      • Networking on OpenBSD
      • System Configuration
      • OpenBSD Basics
      • Managing Software: Packages and Ports
    • Part II. Daily Operations
      • OpenBSD Desktop Environments
      • Multimedia
      • Printing
      • Linux Compatibility
      • Windows Compatibility
      • Games
    • Part III. System Administration
      • Virtualization
      • Storage and File Systems
      • Updating and Upgrading
      • Localization
      • The OpenBSD Boot Process
      • Security
    • Part IV. Networking & Daemons
      • Services
        • Database
          • MariaDB
          • PostgreSQL
          • Redis
          • memcached
        • Directory
          • YP (NIS)
          • LDAP
        • File
          • NFS
          • Samba
        • FTP Services
          • ftpd
          • ProFTPD
          • vsftpd
          • Pure-FTPd
          • TFTP
        • Mail
          • OpenSMTPD Mail Server
          • Dovecot IMAP and POP3 Server
          • Postfix
          • Exim
          • Rspamd
        • Name
          • Unbound DNS Resolver
          • NSD Authoritative DNS Server
          • BIND DNS Server
        • Networking
          • OpenBGPD
          • rad
          • DHCP on OpenBSD
          • slaacd
        • Web
          • Apache HTTP Server
          • nginx Web Server
          • OpenBSD httpd Web Server
          • relayd Reverse Proxy
        • Logging
          • syslogd
        • Monitoring
          • SNMP
        • Remote Access
          • Audit OpenSSH
          • OpenSSH Server
        • File Synchronization
          • rsync
        • Messaging
          • RabbitMQ Message Broker
        • Time
          • NTP Time Synchronization
        • Load Balancing
          • Build Redundant Load-Balanced Gateways
          • Load Balance Services with NAT or DSR
          • Build an HA HTTPS Load Balancer
      • PF
        • pfctl cheat sheet
        • PF Anchors
        • PF Filter Rules
        • PF Forwarding
        • PF Lists and Macros
        • PF Load Balancing
        • PF Logging
        • PF NAT
        • PF Options
        • PF Policies
        • PF Shortcuts
        • PF Tables
      • Advanced Networking
        • High Availability and State Replication
        • Multi-WAN and Policy-Based Routing
        • VPN and Cryptographic Tunneling
        • Classic and Lightweight Tunnels
        • IPv6 at Scale
        • QoS and Traffic Shaping
        • MPLS and Label Distribution
        • Network Services at Scale
        • Virtualization and Host Networking
        • Large-Scale L2 and L3 Design
        • Telemetry, Logging, and Flow Export
        • Hardening and Operational Safety
        • Reference Architectures
        • Troubleshooting Playbooks
      • Serial Communication
    • Part V. Miscellaneous
      • Virtualization Cheat Sheet
      • OpenBSD Cheatsheet
      • How-to Guides
        • Installation and First Boot
          • Complete the First 30 Minutes After Installation
          • Check Hardware Compatibility Before Installing
          • Bootstrap Wi-Fi Firmware Without Ethernet
          • Run OpenBSD as a Virtual Machine Guest
          • Install OpenBSD on a VPS or Cloud Server
          • Install OpenBSD with Full-Disk Encryption
          • Dual-Boot OpenBSD on a UEFI System
          • Automate OpenBSD Installation with Autoinstall and PXE
        • Desktops and Laptops
          • Set Up OpenBSD as a Laptop or Workstation
          • Configure Laptop Power Management
          • Troubleshoot Web Browsers on OpenBSD
          • Use Plan 9 Tools on OpenBSD
          • Build a Minimal Desktop with suckless Tools
          • Install Z shell (zsh)
        • Networking and Remote Access
          • Create an Administrator Account with doas and SSH Keys
          • Configure Secure Remote Access with OpenSSH
          • Use FIDO Security Keys with OpenSSH
          • Configure Wi-Fi Roaming and Wired Failover
          • Troubleshoot PF, NAT, and Routing
          • Route Multiple VLANs with PF
          • Configure a Road-Warrior WireGuard VPN
          • Route IPv6 Networks without NAT
          • Test OpenBGPD with Two Providers
          • Unlock an Internal Service with an SSH Key
          • Build a Simple Router and Firewall
        • Servers and Services
          • Set Up WordPress on OpenBSD
          • Build a Mail Server with OpenSMTPD, Dovecot, and Rspamd
        • Security, Maintenance and Recovery
          • Establish a Conservative Security Baseline
          • Recover Access and Reset the Root Password
          • Collect OpenBSD Diagnostic Evidence
          • Troubleshoot Package Installation and Update Failures
          • Schedule Recurring Maintenance
          • Monitor an OpenBSD System
          • Back Up and Restore an OpenBSD System
          • Configure softraid RAID1
          • Recover an OpenBSD System That Does Not Boot
        • Building, Automation and Virtual Machines
          • Manage OpenBSD with Ansible
          • Build Third-Party Software from Ports
          • Build OpenBSD from Source
          • Plan a Docker Workload Migration to OpenBSD
      • OpenBSD for Linux Users
      • OpenBSD for FreeBSD Users
      • OpenBSD for macOS Users
    • OpenBSD FAQ
    • OpenBSD Architectures
      • OpenBSD Package Search
        • Synopsis
        • Configuring Locales and UTF-8 Support
          • Locale Environment Variables
          • Available Locales
          • Using UTF-8 in the Console
          • Persistent Locale Configuration
        • Timezone Configuration
          • Installer Timezone Selection
          • Setting Timezone Manually
          • Checking the Current Timezone
          • Coordinated UTC and RTC Handling
        • Console Keyboard Layouts
          • Listing Available Keymaps
          • Setting the Keymap Temporarily
          • Persistent Keyboard Configuration

        Localization

        Synopsis #

        OpenBSD base supports the C/POSIX locale and UTF-8 character handling. It does not provide a full set of translated messages or locale-specific numeric, date, and sorting rules. Keyboard layout and timezone are configured separately. Packaged applications may provide additional internationalization.

        Configuring Locales and UTF-8 Support #

        Locale Environment Variables #

        locale(1) displays the environment. In base, LC_CTYPE controls character encoding; other locale categories are not implemented. LC_ALL overrides category-specific settings and LANG supplies the default.

        locale
        export LC_CTYPE=en_US.UTF-8
        

        A name such as de_DE.UTF-8 selects UTF-8 handling; it does not make base messages German or change the date format.

        Available Locales #

        locale -a
        

        Consult the installed locale(1) and setlocale(3) manuals. OpenBSD does not require generating or installing a collection of compiled regional locales.

        Using UTF-8 in the Console #

        Use a terminal and font that can display the needed characters. An encoding setting cannot add missing font glyphs, and individual utilities differ in multibyte support. An SSH connection uses the display capabilities of the client terminal. Console font and keyboard support depend on the hardware and console driver.

        Persistent Locale Configuration #

        Example: .profile (for sh, ksh, etc.) #

        export LC_CTYPE=en_US.UTF-8
        

        Example: /etc/login.conf #

        Set the setenv capability in the user’s existing login class, preserving the file’s continuation syntax:

        :setenv=LC_CTYPE=en_US.UTF-8:
        

        Merge this into any existing setenv list. This sets LC_CTYPE. After editing, rebuild the database and log in again:

        doas cap_mkdb /etc/login.conf
        

        See login.conf(5) .

        Timezone Configuration #

        The system timezone is selected through /etc/localtime, normally a link to a file under /usr/share/zoneinfo. A user’s TZ environment variable can override the timezone for that user’s processes.

        Installer Timezone Selection #

        The installer asks for a timezone. To change it after installation, update /etc/localtime as shown below.

        Setting Timezone Manually #

        For example:

        doas ln -sf /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime
        date
        

        Long-running applications may cache timezone information and need restarting. A system reboot is not normally required.

        Checking the Current Timezone #

        readlink /etc/localtime
        date
        

        Coordinated UTC and RTC Handling #

        Prefer a hardware clock set to UTC. The kern.utc_offset control supports hardware clocks using local time; it is not the timezone setting or a display of the current UTC time.

        sysctl kern.utc_offset
        date -u
        

        Use ntpd(8) to synchronize system time. OpenBSD does not provide the Linux hwclock command.

        Console Keyboard Layouts #

        wsconsctl(8) configures supported wscons console keyboards. X11 uses its own keyboard configuration.

        Listing Available Keymaps #

        Consult kbd(8) for layout names. There is no /usr/share/wscons/keymaps/ directory of layout files to install.

        Setting the Keymap Temporarily #

        doas wsconsctl keyboard.encoding=de.nodead
        doas wsconsctl keyboard.encoding
        

        Persistent Keyboard Configuration #

        Add the setting to /etc/wsconsctl.conf:

        keyboard.encoding=de.nodead
        

        Apply it now with wsconsctl as above. The boot scripts read the configuration at startup; there is no rc.d/wsconsctl service to restart.

        Report a bug
        • Synopsis
        • Configuring Locales and UTF-8 Support
          • Locale Environment Variables
          • Available Locales
          • Using UTF-8 in the Console
          • Persistent Locale Configuration
        • Timezone Configuration
          • Installer Timezone Selection
          • Setting Timezone Manually
          • Checking the Current Timezone
          • Coordinated UTC and RTC Handling
        • Console Keyboard Layouts
          • Listing Available Keymaps
          • Setting the Keymap Temporarily
          • Persistent Keyboard Configuration