The other day I had started typing “ls” while sshed to a RedHat machine and had only typed the “l” when I suddenly decided I needed to switch away to look at something else.
On the Mac, you switch to other running apps with Apple-TAB, but I managed to hit the TAB first and somehow managed to “bounce” it.
Of course the Linux bash shell responded as it should have, listing “l” commands for me. As it also beeps after the first tab, and as I was expecting to switch away, naturally the list caught my attention more than it might have otherwise. This happened to be an older machine so the “l” list was short enough to just display without asking me if I really wanted to see all the possibilities. If it hadn’t been, I probably just would have said “N”. But there they were, “l” commands.
Two of them caught my eye: “lchfn” and “lchsh”. What the heck are those, I wondered?
Neither had man pages and when I tried “lchfn –help” it wasn’t very helpful. Attempting “lchfn -i” asked for a password but wouldn’t authenticate me. I decided it was time to get back to whatever it was I had been trying to do before this side trip.
However, I remembered that, and later in the day I logged into a new Fedora Core 5 box. This had the same two commands and a few more: luseradd and luserdel were two I noticed right away. The Fedora also had man pages, but these were even more puzzling. The commands obviously served the same functions as their equivalents without the leading “l”, but the man pages were much shorter. And there was another difference: at the end of each man page, where other commands might say “System Management Command” and a date, these all said “libuser”.
Huh? What’s “libuser”?
A visit to /usr/share/doc/libuser-0.54 enlightened me a little, as did the accidental discovery of libuser.conf in /etc. Apparently libuser is RedHat’s attempt to bring user management tasks under one unifying library. The docs say:
The libuser library implements a standardized interface for manipulating and administering user and group accounts. The library uses pluggable back-ends to interface to its data sources. Sample applications modeled after those included with the shadow password suite are included.
It makes sense to consolidate this stuff , and a search of Google seems to show that other distros may be picking up on this as well: there’s a Debian version and you’ll find “libuser-perl” in Ubuntu (I’m not certain that’s directly related but it definitely serves the same function).
So the question is: are we supposed to be using this stuff? Apparently higher level tools may use this library: I think I’m reading correctly that RedHat’s text and gui tools call routines from libuser. Should “luseradd” replace “useradd”?
Apparently not quite yet. The README on FC5 says:
This package is still under development, but the API appears to have settled to the point where it’s reasonable to write applications with it.
So, the mystery of “lchfn” and “lchsh” was solved. The “libuser” concept is apparently still in progress, but may be completely deployed someday.
*Originally published at APLawrence.com
A.P. Lawrence provides SCO Unix and Linux consulting services http://www.pcunix.com