I recently had to manually add a few users to /etc/passwd and /etc/master.passwd on an OpenBSD 3.9 server. After I added the entries, the accounts were still unable to login. I started poking around with ktrace, and noticed that during a normal account creation session the files /etc/pwd.db and /etc/spwd.db were modified:
$ ls -la /etc/aliases.db /etc/hddtemp.db
-rw-r–r– 1 root wheel 40960 Nov 23 05:38 /etc/pwd.db -rw-r—– 1 root _shadow 40960 Nov 23 05:38 /etc/spwd.db
After seeing this, I went and read up on both of these files. It turns out that /etc/passwd and /etc/master.passwd get converted to database files by pwd_mkdb, and then the database files are used for actual authentication. Once I ran pwd_mkdb by hand:
$ pwd_mkdb /etc/master.passwd
Everything worked as expected. I reckon other operating systems use database files as well, so I will have to keep this in mind the next time I try to muck with a credential repository manually.
I like several things about the Solaris service management facility (SMF), but one thing I don’t care for is SMF redirecting the output from startup scripts to logfiles in /etc/svc/volatile and /var/svc/log. Call me old fashion, but I like to view the boot progress on the console, and periodically use the console output to troubleshoot problems with the boot process. That said, it is possible to get the system services to log to the console during boot, but it requires hacking /etc/rc[0-6] to write to /dev/sysmsg instead of STDOUT. For individual startup scripts, you can add entries similar to the following to have output displayed on the console during boot:
echo “Writing to the console” > /dev/sysmsg
Console output is an extremely useful debugging tool, and I really wish you could pass an option ( boot -vx doesn’t cut it) to the kernel to tell SMF to write to the console instead of individual logfiles.
I periodically need to format text data on my Linux desktop for printing, and have always gone about this in one of two ways. If I want to add margins and make the data conform to a specific page length, I use the pr utility. Here is an example that formats FILE with a #4 margin, a #72 width (the default), and a length of 60 lines:
$ pr -o 4 -l 60 FILE
If I have a text document that I want to format to 80-characters per line, I typically use fmt with the width option. The following example will force all lines to 80 characters, and will gracefully wrap lines if they exceed this limit:
$ fmt -80 FILE
If you have any other methods for formatting text, I would love to hear them.
While surfing the web, I came across streamtuner. Streamtuner can be used access 1000s of online streaming media sources, and is a GTK+ application written for GNOME. I loves me some music, and am stoked that I now have a good tool to listen to streaming audio on my Linux desktop.
Apache allows you to create hundreds of virtual host containers. Each container is required to have a ServerName directive, which contains the domain name associated with the virtual host. In addition to a server name, one ore more aliases can be associated with the virtual host with the ServerAlias directive. Aliases can contain a domain, or a regex that allows you to match based on some specific criteria. This is super useful, and allows you to do things like this:
NameVirtualHost 192.168.1.18:8080
<VirtualHost 192.168.1.18:8080>
ServerName foo.com
ServerAlias *.foo.com
</VirtualHost>
<VirtualHost 192.168.1.18:8080>
ServerName bar.com
ServerAlias *.bar.com
</VirtualHost>
This opens a whole slew of cool and interesting possibilities for virtual hosting. Niiiiice!