Category Archives: BSD

Initial OpenBSD Settings

Here is a list of settings that need to be configured to make OpenBSD comfortable for a new user.    New to BSD not necessarily new to the system.  Setting up and using OpenBSD is a simple task.  The installer walks you though all of the basic settings you need to have a fully functional system in a couple of minutes.  Whether you are setting up a server or a desktop once the installer completes you can be up and running on your fresh OpenBSD system.

The options below are the minimum changes you will need to make to make your OpenBSD environment more user friendly.

Setting the PKG_PATH

After booting your OpenBSD box you will inevitably want to update the system or install packages.  The simplest way to accomplish this is by using the PKG system.  To do this you will need to configure your PKG_PATH.  As root edit /root/.profile  and append the following line.

export PKG_PATH=http://openbsd.mirrors.pair.com/$(uname -r)/packages/$(uname -p)/

In the couple of hours that this has been published I have found a wonderful site with lots of updated OpenBSD information.  Here I found a  better way to manage the PKG_PATH.

You can add your installpath, which translates to PKG_PATH, with in the /etc/pkg.conf file.  This file does not exist when you initially install OpenBSD.  The /etc/pkg.conf file should look something like below.

installpath = openbsd.mirrors.pair.com

Replace openbsd.mirrors.pair.com with your favorite or local mirror of OpenBSD

Setting your prompt

If you are managing a large datacenter of servers you will find having colorful prompts beneficial.  A red root prompt Accidentally destroying a system by running a command as root.  Easily identifying which terminal windows are root windows is ideal.  To accomplish this you can edit one of two files.  The proper way to make this change is to either set it globally in /etc/ksh.kshrc or set it in either ~/.kshrc or ~/.profile.  Since we are already editing ~/.profile for PKG_PATH we should keep using ~/.profile for all of our settings.

As root edit ~/.profile and append the following line.

export PS1="\033[31m\u@\h\033[00m:\033[36m$\w\033[00m$ "

If you would like a nice green prompt on your user profile edit the .profile in ~/.profile as your user and append the following.

export PS1="\033[32m\u@\h\033[00m:\033[36m$\w\033[00m$ "

Setting ksh history file

KSH history is essential for keeping track of commands that have been run on the system.  Being able to look through past commands is the first step in troubleshooting what has changed on a system.  To set the history file you need to append the following line to ~/.profile with your favorite editor.

export HISTFILE=~/.sh_history

To activate all of the changes with out logging out and back in you can run the following command

. ~/.profile

I will add more settings as I come up with them.  As a relative newbie to OpenBSD let me know what your favorite settings are and I will add them to the list.

-Oldwulf