First Login

For the first login, I used the root account. That logged me in to a default desktop that looked like this:

First Login as Root

This is the FVWM window manager. While this is a perfectly fine window manager with many fans, I actually want to use cwm. The "calm window manager", or cwm, is one of three window managers included in the base of OpenBSD (the others are FVWM and twm).

In order to login and have cwm start instead of FVWM, I need to understand what happens during login. After entering a username and password on the xenodm login screen, OpenBSD will look in two places for a file that contains configuration instructions to run on login. This file is a script which runs commands starting at the top and working its way down. These can be pretty complicated with if...else statements, loops, and other such things. It first looks in the home directory for the account I'm logging in with for a script file called .xsession and if it dosn't find one it tries for a default located at /etc/X11/xenodm/Xsession.

Since there is no .xsession in my root account's home directory (yet), the Xsession file in /etc/X11/xenodm is used instead. I'm going to change that by creating an .xsession file for root. I fire up a terminal window and create an .xsession file in the root home directory with:

# vi ~/.xsession

That command simply started the vi text editor and created the file .xsession in the root account's home directory.

First, I wanted to get rid of the weird black and white pattern that's set as the background. I found I could do that in the .xsession file by using a program called xsetroot. This program has a lot of possible options while looking over the man page, but in this case I just want to use it to set the background to dark grey. I typed in the following command in the .xsession script. In vi I did this by pressing the I key to enter insert mode.

xsetroot -solid darkgrey &

The "&" at the end of the command is a command operator that tells the computer to run the command in the background and immediately continue, so xsetroot will run "behind the scenes" to keep my background dark grey.

I also want to have cwm run as my window manager when logging in as root, not FVWM. That was simple enough to do by adding:

cwm

There is no "&" here because I want cwm to front and center and if I quit cwm, I want my session to end and drop me back to the xenodm login screen.

So, my root account's .xsession file looks like this:

    xsetroot -solid darkgrey &
    cwm
  

To write this as a file and exit vi, I pressed the ESC key to enter command mode, then typed :wq to save and quit.

Finally, to see my new .xsession for the root account, I exited FVWM by clicking the left mouse button (M1) and selecting Exit.

When I logged back in as root, I saw the following which is exactly what I wanted!

New Root Desktop using CWM instead of FVWM

doas

When I use other UNIX-like operating systems like GNU/Linux, I utilize the program sudo quite a bit. I don't want my every day user account to have all the extra permissions of root, nor do I want to login as root if I don't have to. This is both for security and to keep me from doing something stupid by mistake.

In OpenBSD, I instead have to use a program called doas. Out of the box, doas denies everyone, even root, from running commands using doas. That means I have to create a .conf file. Because I would like doas to work as close to sudo as possible, I'm going to configure it as such. What I want to do is:

  1. Allow members of the 'wheel' group to use doas to run as root, but temporarily, just like sudo
  2. Allow root to always run whatever it wishes, because, hey, root

Now that I'm in cwm, I need to open a terminal window. I can do that by pressing Control+Alt+Enter (also known as Control+Meta+Enter or CM+Enter for short). Every time I press that key combo a new terminal window opens.

Using userinfo aaron I see that my account, aaron, already is part of the wheel group. If you added your normal user account(s) during the OpenBSD installation all of them will be in the wheel group automatically. Next, I need to create the doas.conf file. This file needs to live in /etc/ so I ran the command:

# vi /etc/doas.conf

And added the following to it:

permit persist :wheel

This copies the sudo functionality of allowing a non-root user in the wheel group, like my regular account, to run a command by adding doas to the beginning. It will prompt me for my account password and shouldn't prompt again for other doas commands for about 5 minutes.

I also added:

permit nopass keepenv root

This allows root to run doas commands as a less privileged user.

After adding those two lines, I saved and exited the file in vi, then pressed Control+Alt+Shift+q (or CMS+q) to exit cwm back to the xenodm login screen to login as my normal day to day account.

What the heck? I'm back at FVWM?!

Oh yah, of course I am! The .xsession I created was for the root account. Since my normal account doesn't have an .xsession, it’s using the default located in /etc/X11/Xenodm/Xsession. I remedied this by creating an .xsession file for my account in the home directory. I would like to use a real picture for a background, but that will come later. For now I used the following for my normal account's .xsession file:

  xsetroot -solid steelblue
  cwm

That should set the background to a blue color. After logging out and back in, I'm seeing:

New Normal User Desktop using CWM instead of FVWM

Testing doas and updating OpenBSD

I of course want to test that my doas .conf is correct, but I also want to update OpenBSD's security patches. You do that by running the syspatch command. If I just run that command I end up getting a message saying it needs to be run as root:

Trying to run syspatch but being denied without root privilages

So instead, I run it with doas and entering my account password when prompted:

running syspatch using doas

and syspatch contacts the OpenBSD servers to see if I need any patches for the OS and applies them if so. Looks like everything is working!

I did discover reading the FAQ for OpenBSD that syspatch updates the core OS only. Other software I install using packages is updated a different way using the command pkg_add -u.

More Tweaking

Another of the things I want to do is remove the weird black and white pattern from the xenodm login screen like I did with my root and normal user account's background. To do this, I edited the /etc/X11/xenodm/Xsetup_0 file as root (or using doas under my normal account).

$ doas vi /etc/X11/xenodm/Xsetup_0

And added:

xsetup -solid black &

I also would like to get rid of the persistent notification console. This sort of thing is great for sysadmins, but as this VM is for general use, I have no need for it. To do this I simply add a "#" to the line above where I added the xsetup root command. This "comments out" the command so it won't run, but it keeps it there if I ever want to use it again simply by removing the "#". The .Xsetup_0 file looked like this. I did the old :wq to save and exit and

Editing Xsetup_0 to configure xenodm

The .Xsetup_0 file is also a script similar to .xsession. After saving the file and exiting cwm, I now see the background of the login screen is solid black and the console is gone both here and when I login to either root or my normal account.

Newly configured xenodm login screen with solid color and no console log

Previous: Initial Setup : Next Up: Installing Programs and More Tweaks

Created: 2018-11-25
Last updated: 2018-11-25