FreeBSD: 101… and a bit
In the last post in this three-parter, we installed FreeBSD on to either a physical or virtual computer. Now we need to apply some basic configuration to adjust permissions, choose a graphical log-in manager and start the desktop. Don’t worry, though: it’s very straightforward!
We have a basic FreeBSD installation, ready and waiting to be started. If we do so, we are presented with the FreeBSD bootloader — and a lovely one it is too. The options are far from an enigma; proceed with the first (default) option. Cast your eyes over the aesthetically repulsive babble that it will spew.
After a short time, we will arrive at the log-in prompt. I hope you remember the password for the ‘root’ account because the first few configuration steps are administrative and need the elevated priviledges.
- It’s So Funny, It’s Been On xkcd.
To perform certain administrative commands, the root account must be used, so normal users cannot mess with the system. If these commands were mistyped, though, running them under the root account can be dangerous. To add a little protection, we shall allow the other user accounts to temporarily obtain administrative privileges through the sudo command. To do this, we must edit the /etc/sudoers file. As in Linux, we can do so by using the visudo command, a wrapper to the vi editor. The file is fairly straightforward; press the ‘Insert’ key to enable editing and duplicate the line that reads as follows, modifying it according to your other username:
root ALL=(ALL) ALL
Press Escape to exit editing mode, and type the following command to save the file:
:write
This will write the new sudoers file. Quit the visudo editor by typing:
:quit
If all is well, you will return to the prompt without any error messages. If errors are displayed, check the syntax of the line and that no others have been accidentally modified by running visudo again. We can now logout from root, back in as the normal user and safely perform administrative commands simply by prefixing your command with sudo. Each time sudo is used, it will ask for the normal account’s password: this ensures commands do not elevate themselves by using sudo without your knowledge. Let’s see sudo in action right-away to edit an configuration file.
- Getting Graphical
By now, you may be a little tired of all this command-line business! While it’s extremely useful to know some shell-fu, there is a more intuative way around your system! The X Window System (a.k.a. X11, or simply X) is the tool for this job — but needs a helping hand from the hardware detection systems before it can be started. How else will it know about your graphics card, monitor or mouse? Use sudo and the familiar text editor vi to add the following lines to the start-up configuration at /etc/rc.conf :
hald_enable="YES"
dbus_enable="YES"
With the two services now starting with the system, X should be able to run. Quit vi to return to the command line. If you don’t want to reboot again, we can start them manually with the following two commands:
sudo /usr/local/etc/rc.d/dbus start
sudo /usr/local/etc/rc.d/hald start
If the two services have started, you should be able to start X when you boot up the system! Should you do this, though, you may not receive quite the interface you expect: your desktop environment, or DE, is the style of interface with which you use your computer. Many fall between two, GNOME & KDE, both of which are available for FreeBSD. So far, neither is preferred as the log-in is performed in a text-based console, after which a user must start X manually. If you wish to use the graphical system for everything, we can change this by adding a graphical login manager to the start-up sequence. This enables users to log-in with a pretty graphical system rather than a command-line and start X manually. To do this, edit the /etc/ttys file and find the line starting with “ttyv8”. If you have installed KDE, use KDM as in the following line; if you have GNOME, use GDM as in the 2nd line:
ttyv8 "/usr/local/kde4/bin/kdm -nodaemon" xterm on secure
ttyv8 "/usr/local/kde4/bin/gdm -nodaemon" xterm on secure
If GNOME is your thing, it might be a good idea to speed up GNOME’s loading mechanism by adding an extra line to /etc/rc.conf as before:
gnome_enable="YES"
That step isn’t necessary for KDE users; it just starts a couple more services behind the scenes to let GNOME start a little quicker.
The GNOME desktop environment is default with GDM but if you wish to just use the KDE desktop with either log-in manager, add KDE4 to .xinitrc in your personal (home) directory:
echo "exec /usr/local/kde4/bin/startkde" > ~/.xinitrc
That’s it! After you have rebooted your system, your system will have gotten graphical! Next up, we need to fit the desktop with all we need for a great forensic environment…
Happy Christmas and New Year to all my readers; I hope the winter break is as relaxing and happy as you hope to set you up for 2010!





