Stories
Slash Boxes
Comments

News for nerds, stuff that matters

BSD Hacks

Posted by timothy on Tue Jul 27, 2004 02:20 PM
from the but-doesn't-wheeze dept.
GMan00 writes "A flurry of BSD UNIX-related (Berkeley Software Distribution) books have hit the bookstores during the recent past, and more are on the way. From books specific to Secure Architectures with OpenBSD in April 2004 and the reissue of The Design and Implementation of the BSD Operating System for FreeBSD 5.x (expected in August 2004), to Michael Lucas' series of BSD Books from NoStarch Press, print documentation is certainly available for those interested in learning about the free, open source UNIX system which powers operations such as Yahoo! portal and Sendmail.org website, Verio and Pair hosting, not to mention web server survey site Netcraft. Dru Lavigne's BSD Hacks (O'Reilly and Associates, May 2004), is the latest book in these releases, and is an enormously useful resource for system administrators and end-users alike." Read on for the rest of George's review.

Dru writes the BSD Basics column on O'Reilly & Associates' OnLamp. Her clarity and fluid style are perfect for those looking to understand aspects of the BSD operating systems. I have had some email communications with Dru about various New York City *BSD User Group-related activities, and managed to speak with her several times at BSDCan this past May.

Like most computer nerds, Dru has a sense of humor. Unlike most, however, she's actually funny.

BSD Hacks is the first book that is almost solely focused on hacks for sysadmins, without boring you with the details for basic operating system installation and configuration that has been so well documented elsewhere. BSD Hacks is not just for sysadmins, though. Intermediate and advanced BSD users will also find the book an excellent tool. For those who find difficulty in BSD installs and other fundamentals, on the other hand, it's best to start with the FreeBSD Handbook, the NetBSD Guide or the OpenBSD FAQ.

There's lots of good hacks buried in the various BSD books, around the internet in different HOWTOs and tutorials. But BSD hacking is the sole purpose of BSD Hacks; there's no need to browse through install screens and overviews of TCP/IP before getting to the heart of the matter.

With 100 listed hacks, multiplied by an impressive level of detailed angles for each, Dru provides an array that demands the placement of this book right in your server room, not in a pile of "must-read-at-some-distant-point-in-the-future" texts.

The majority of hacks are applicable to all the BSDs, including Darwin and OS X, although some are specific to one BSD or another.

This review obviously can't list every hack, although you would be smart to sit and work through the book yourself over a weekend or two. But it is possible to provide a good flavor of BSD Hacks in brief. O'Reilly and Associates does give a good glimpse on their Sample Hacks page, but let's do a quick work through ourselves.

The first chapter is called "Customizing the User Environment," and is probably best for end-users looking to go beyond their first steps. But it does include some useful hacks, such as "Use an Interactive Shell" that certainly fit well into the arsenal of any sysadmin, not to mention Hack #12 "Use Multiple Screens on One Terminal."

The second chapter, "Dealing with Files and Filesystems" also contains gems for both end-users and sysadmins. The use of mtree, which maps a directory hierarchy, is mentioned as a tool for recovery. Later on in chapter 6, Dru details its use for making a hacked data integrity checker, thus filling the role often played by products such as Tripwire.

Another great tool Dru covers in the second chapter is g4u, a free ghosting program that gives you the ability to perform quick restores over ftp. Ghosting a drive image is an incredibly useful tool, whether it's about replicating servers or doing a quick reinstall and configuration when a server fails in an emergency.

Chapter 3 is entitled "Boot and Login Environments." It gives some hacks that aren't just for basic system administration, but also some useful security ones including changing your /etc/passwd file to Blowfish encryption and utilizing OPIE for one-time passwords, which is built into FreeBSD.

"Backup Up" is the focus of Chapter 4. It includes some very creative methods of dealing with maintaining that necessity, and also includes an excellent primer on Bacula, which is increasingly gaining prominence as a cross-platform backup system.

Chapter 5 covers "Network Hacks," and continues on educating a sysadmin. Included in this chapter is the tcpdump program, a vital tool for watching traffic flowing by your network interfaces.

There's a strong security focus in Chapter 6, entitled "Securing the System." While security hacks are sprinkled generously throughout the book, this chapter works with firewalling with IPF and PF, in addition to covering SSH and Snort. It also includes the earlier mentioned 'intrusion detection-lite' approach with mtree.

Chapter 7, "Going Beyond the Basics" explores scripting, analyzing dreaded buffer overflows and more. Dru also includes a bit on "Creating a Trade Show Demo," not something you'd expect documented in print anywhere, but nevertheless quite useful for anyone working for the BSDs at a conference.

Dru continues with "Keeping Up-to-Date" in Chapter 8, which includes useful details on upgrading and downgrading your installed ports.

The final chapter is "Grokking BSD." "Grok," as Dru comments, refers to the science fiction writer Heinlein's Martian phrase for having a "thorough understanding." Dru covers creating your own manual pages, dealing with custom patches, playing with dictionaries and more.

Certainly there are no walls between each chapter, as many of the hacks could be shifted around. All the more reason to work your way through the book from beginning to end.

One useful addition for this book could have been somehow denoting which of the BSDs (in some cases, it's all of them) to which each listed hack can be applied. Certainly not all are available to Darwin and Apple's OS X. And certainly there's no point in making the OpenBSD /etc/passwd file encrypted in Blowfish, since that is its default.

While many of the hacks are found somewhere in the manual pages, on some useful website, buried in another book or in the minds of some developer somewhere, they're not necessarily in the annals of official documentation. But there's no single book or site that provides the depth and breadth that Dru provides. She managed to tap into the thoughts of dozens of developers and sysadmins around the world, greatly enhancing the variety of hacks in this book.

As a side note, the scope of BSD Hacks isn't limited to just the BSD family. Many of these are likely applicable to Linux and the other UNIX systems. But with recent, impressive increases in the BSD install base, there's a good chance that you can access a BSD box somewhere.

Whether you're a sysadmin managing hundreds of servers, or a power user ready to go beyond the obvious, BSD Hacks belongs next to your CRT.


You can purchase BSD Hacks from bn.com. Slashdot welcomes readers' book reviews. To see your own review here, carefully read the book review guidelines, then visit the submission page.

This discussion has been archived. No new comments can be posted.
Display Options Threshold:
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • Recent Past (Score:5, Funny)

    by Anonymous Coward on Tuesday July 27 2004, @02:26PM (#9814841)
    From the write-up "have hit the bookstores during the recent past"

    Yes, those are much easier to review than those that arrive in the recent future.

    FYI, the word you are looking for is "recently".

    HTH
    • Re:Recent Past by cpghost (Score:2) Tuesday July 27 2004, @03:06PM
    • OOOWWW by ShadowRage (Score:2) Tuesday July 27 2004, @04:20PM
    • Re:Recent Past by _Sharp'r_ (Score:2) Tuesday July 27 2004, @11:50PM
      • 1 reply beneath your current threshold.
    • 2 replies beneath your current threshold.
  • Oh my! (Score:1, Funny)

    by Anonymous Coward on Tuesday July 27 2004, @02:28PM (#9814859)
    *BSD is... ALIVE!
    • Re:Oh my! by twigles (Score:2) Tuesday July 27 2004, @03:06PM
  • by GillBates0 (664202) on Tuesday July 27 2004, @02:30PM (#9814887)
    (http://slashdot.org/~GillBates0 | Last Journal: Tuesday July 10, @04:36PM)
    What can you expect when the article summary contains references to both Netcraft and BSD.

    I can hear the sound of a million BSD-is-dying trolls banging on their keyboards.

  • Legitimate question. (Score:5, Interesting)

    by lpangelrob2 (721920) on Tuesday July 27 2004, @02:32PM (#9814904)
    (Last Journal: Friday February 18 2005, @03:11PM)
    Is a hacks book a good way to go about learning more about the insides of an OS (BSD) and how it works, or are there other books out there for this purpose? I know elementary UNIX (if you count Terminal OS X as UNIX) but I'm not sure if books like this are a good way to broaden the scope of what I know in the language, or just specific directions and instructions on how to get some things power users have always wanted to work... to work.
    • Re:Legitimate question. (Score:5, Informative)

      by Unnngh! (731758) on Tuesday July 27 2004, @02:40PM (#9814985)
      (Last Journal: Wednesday June 29 2005, @09:39PM)
      I've found books help to take me over certain hurdles in learning, particularly with unix. That being said, I kindof need to hit a hurdle for them to be useful, or at least have enough real experience under my belt to see how the material is applicable. Unix Power Tools is a great book, it will show you so many nuts and bolts of any Unix-like OS that it will really put you in another realm. But try picking it up as a noob, it'll only give you a massive headache.
      [ Parent ]
    • Re:Legitimate question. by name773 (Score:1) Tuesday July 27 2004, @02:45PM
    • Re:Legitimate question. (Score:5, Informative)

      by Short Circuit (52384) <mikemol@gmail.com> on Tuesday July 27 2004, @02:46PM (#9815051)
      (http://shortcircuit.us/ | Last Journal: Sunday October 14, @02:01AM)
      For me, O'Reilley's Linux in a Nutshell [oreilly.com] allowed me to charge in with both guns drawn back in 2000. (Read: I'd hosed my Windows installation, and the Compaq restore CD wasn't working.)

      They have books on both Linux and BSD here [oreilly.com]. And, so long as you have a machine to read them from, check out their Safari service. I loved it. (but had to cancel to pay for tuition last Fall. I'm still planning on going back.)
      [ Parent ]
    • Re:Legitimate question. by fiskbil (Score:3) Tuesday July 27 2004, @02:53PM
    • Re:Legitimate question. (Score:4, Informative)

      by joeykiller (119489) on Tuesday July 27 2004, @03:14PM (#9815326)
      (Last Journal: Friday July 09 2004, @03:58AM)
      Is a hacks book a good way to go about learning more about the insides of an OS (BSD) and how it works, or are there other books out there for this purpose?
      I haven't read "BSD Hacks", but I have read O'Reilly's "Linux hacks". If BSD Hacks is anything like the O'Reilly book "Linux hacks", I'd have to say that the answer is no.

      Don't misunderstand -- "Linux hacks" is an awesome book, but it is a book that helps users that have some experience solve a couple of (or more like 100) special problems you really have to experience before you even know they exist. I don't know if this makes any sense, but what I'm trying to say is that it may be more suited for experienced users.

      Since you seem to be an OS X user I think you'd get more help from another O'Reilly book: Learning Unix for Mac OS X Panther [oreilly.com]. It teaches you the basics and might even get you far enough to experience the kind of situations where you'd start wanting a Hacks book.
      [ Parent ]
    • Re:Legitimate question. by value_added (Score:3) Tuesday July 27 2004, @05:02PM
    • Re:Legitimate question. (Score:4, Informative)

      by chromatic (9471) on Tuesday July 27 2004, @05:26PM (#9816542)
      (http://wgz.org/chromatic/)

      The goal of a Hacks book is much different from a Cookbook. A Cookbook will cover everything common you'll eventually want to do. A Hack will cover things you may never have known you want to do, but will want to do after you read them.

      (I edited this book, so that was my goal at least.)

      [ Parent ]
  • Awesome hack. (Score:3, Funny)

    by Eric_Cartman_South_P (594330) on Tuesday July 27 2004, @02:35PM (#9814940)
    Here's a really cool hack... it's one of my favorite:

    http://www.apple.com/macosx/ [apple.com]

  • Secure architectures (Score:5, Informative)

    by carnivore302 (708545) on Tuesday July 27 2004, @02:40PM (#9814983)
    (http://tradesims.com/mystery.html | Last Journal: Tuesday March 22 2005, @05:56AM)
    I happen to own Secure Architectures with openBSD [amazon.com]. While it covers a lot of ground found in other admin books as well, there are some nice things to be found here. Especially the comments on how-not-to-do-it were sometimes... well let's say useful :-)

    Click on the Mystery Futures Link [tradesims.com]!
  • Alive and well (Score:5, Insightful)

    by shaitand (626655) on Tuesday July 27 2004, @02:46PM (#9815050)
    (http://www.ganjablogger.com/ | Last Journal: Thursday January 05 2006, @05:36PM)
    It's good to see BSD getting some well deserved recognition.

    Although BSD isn't commonly seen as an end platform in practice (with some notable exceptions), the code and technology in it are probably used in favorite OS no matter what OS that is.

    So for once guys, be you linux fans, windows fans, or OS X fans, tip your hats. We should all be encouraging the growth and development of BSD.
  • About BSD-Hacks (Score:5, Interesting)

    by koinu (472851) on Tuesday July 27 2004, @02:48PM (#9815079)
    (http://m8d.de/)

    There is no question. This book is useful and one of the best books that I've seen for a long time.

    I'm using FreeBSD 4 and 5. That's why I like this book really much. It gives so many examples how to cope with shell settings, file systems, backups and many other typical problems. I have learned a lot from this book.

    This here, is not the whole truth:

    The majority of hacks are applicable to all the BSDs, including Darwin and OS X, although some are specific to one BSD or another.

    While reading this book you will find quite a lot passages saying: "For NetBSD, look at: http://...", "For OpenBSD, try: http://...", "Unfortunatelly, NetBSD..." or explaining NetBSD/OpenBSD features in one short paragraph and pointing to man-pages, while FreeBSD is explained with lots of details. I mean, this does not disturb me, but it might be annoying for other users.

  • *BSD as a Four Letter Word (Score:5, Insightful)

    by karniv0re (746499) on Tuesday July 27 2004, @02:50PM (#9815094)
    (http://myspace.com/bdetweiler | Last Journal: Sunday February 20 2005, @01:44PM)
    What is it with the "Slashdot Scene" that the mere mention of *BSD invokes insults from every corner. I can see this coming from the Microsoft crowd, but from FOSS advocates?

    Come on people, it's not like you pay for it! It's just as free as Linux! Each serve their purpose. Now, if you can't say anything positive, don't say anything at all.
  • The fight continues (Score:1, Funny)

    by Bill Hayden (649193) on Tuesday July 27 2004, @03:01PM (#9815181)
    (http://www.haydentech.com/deals.php)
    I see someone is still taking up arms in the "hack vs. crack" nomeclature war. I thought we had surrendered.
  • Informative review (Score:5, Insightful)

    by bastardadmin (660086) on Tuesday July 27 2004, @03:13PM (#9815321)
    (Last Journal: Saturday November 06 2004, @08:56PM)
    Documentation is a good thing.
    Good documentation is considerably better.

    It's good to see that the market is there for decent, affordable reference works for more than just Linux and Windows (though the latter is debatable... and that's not trolling, I have been a Windows admin for years and the thing that keeps me running Linux and *BSD baxes in my environments is that, as a rule, the documentation is a hell of a lot more affordable and accessible and generally better).

    It is a shame that any BSD story on slashdot has to be inundated with the same tired "BSD is dead" trolls. Not that I am surprised to see trolling here, but get some creativity FFS (and that doesn't mean Fast Filesystem in this context).
    You aren't even worth the mod points to flag you for what you really are, you sad, friendless twits.
  • Unix Power Tools (Score:5, Interesting)

    by TilJ (7607) on Tuesday July 27 2004, @03:18PM (#9815370)
    (http://www.seekingfire.com/)
    This book (which I picked up in a recent book shopping binge) reminds me most of Unix Power Tools. I own the 2nd edition and I've reviewed [rospa.ca] the 3rd edition. The similarities to the "Hacks" series is striking (not surprising, considering that they're both published by O'Reilly). The "Hacks" books seem to be shorter and with fewer tips receiving more thorough treatment.

    A comment I wrote for the Power Tools review applies to BSD Hacks as well:

    Among the most hyperlinked book I've seen, this book is filled with hundreds of useful tips and, perhaps most interestingly, Unix culture. It's only marginally successful as a reference manual or as a teaching aid as it focuses on the useful-but-obscure aspects of Unix. Where it truly excels is in steeping the reader in ``How do I''-style Unix lore until it comes out of their pores.
  • My good friend Michael Vince had two of his scripts included in the BSD Hacks book, including Quickpatch [roq.com] which was also featured as a sample chapter [oreilly.com]

    His projects website is here at ROQ.COM [roq.com] and also has the very useful IPFilter script [roq.com].

    As an aside, he said that in his bio in the book, OReilly credited him with different hacks than the ones he actually wrote... editorial snafu.
  • Another view on "BSD Hacks" (Score:5, Interesting)

    by hubertf (124995) on Tuesday July 27 2004, @04:59PM (#9816330)
    (http://www.feyrer.de/ | Last Journal: Sunday February 16 2003, @07:49PM)
    Being a long term NetBSD user, I'm not too thrilled by the mixture of contents in the book. See my NetBSD blog entry [feyrer.de] for a few more details.

    - Hubert

  • Secure Architectures with OpenBSD (Score:4, Informative)

    by zyche (784345) on Tuesday July 27 2004, @05:10PM (#9816418)

    I bought a copy of Secure Architectures with OpenBSD [amazon.com] and I think it is quite good, especially if you consider its relatively low price.

    It's not that it cover every detail of every feature of OpenBSD, rather it many gives some background to them that the (ohh so excellent) man pages doesn't provide. For example: while the man page explain what rarpd does, the book admits that the service is quite archaic. :-)

    I like it, and have learned a lot from it, even then I thought I knew most of it (or know where to look).

  • by evilviper (135110) on Tuesday July 27 2004, @05:44PM (#9816727)
    (Last Journal: Monday October 15, @11:53PM)
    From the samples, it doesn't look good at all... It was written by someone with rather limited knowledge, who doesn't really like to do things the right way.

    For instance, hack 100 tells you to copy the ~/.Xauthority file from user "dru" to root's home, then set DISPLAY. This is so root can display an X11 window...

    The right way to do this is to:
    A) use "xhost" as "dru". Specifically, "xhost +local:root" will give root access to the X server. If you're root, it's easy to su to dru, run xhost, then exit back to the root shell.
    B) instead of exporting "DISPLAY" manually, it's best to just leave the "-l" off of SU, and inherent that variable automatically. Afterall, it could be DISPLAY=:19.0
    • 1 reply beneath your current threshold.
  • Does it cover DragonFly BSD? (Score:1, Interesting)

    by Anonymous Coward on Tuesday July 27 2004, @05:52PM (#9816803)
    Do any of these new books cover DragonFly BSD? I'm in the process of switching all my computers over from FreeBSD to DragonFly. It would sure be nice to have some DragonFly books.
  • by FUF (68684) on Tuesday July 27 2004, @06:10PM (#9816987)
    (http://www.phuph.org)
    Anyone know of any good literature out there on *BSD written as such that it is geared towards experienced Linux sysadmins? i.e. offering a list of key differences (or similarities) on various levels of system organization, administration, common/best community practicies etc.?
  • Re:*BSD is dying (Score:3, Informative)

    by Anonymous Coward on Tuesday July 27 2004, @02:28PM (#9814856)
    Good News Everyone!
    Turns out that *BSD is stronger than ever!
    According to an Inernetnews article [internetnews.com], Netcraft has confirmed that *BSD has "dramatically increased its market penetration over the last year."
    There has been a steady increase in *BSD developers over the past decade.
    There are currently 307 FreeBSD developers as of the 2004 core team election. [freebsd.org]
    You can read more about FreeBSD here [freebsd.org]

    If you would like to try out a BSD, you can download: FreeBSD [freebsd.org], OpenBSD [openbsd.org], NetBSD [netbsd.org], or DragonflyBSD [dragonflybsd.org]
    Enjoy!
    [ Parent ]
  • supported for longer

    So they've found a new way to hide "BSD is dying" in their trolls?
    [ Parent ]
  • Humanity is dying (Score:1, Funny)

    by Anonymous Coward on Tuesday July 27 2004, @03:16PM (#9815356)
    It is official - Netcraft now confirms: Humanity is dying

    One more crippling bombshell hit the already beleaguered Human community when IDC confirmed that Human market share has dropped yet again, now down to less than a fraction of 1 percent of all things on the net. Coming on the heels of a recent Netcraft survey which plainly states that Humans has lost more market share, this news serves to reinforce what we've known all along. Humanity is collapsing in complete disarray, as fittingly exemplified by failing dead last [samag.com] in the recent Sys Admin comprehensive networking test.

    You don't need to be a Kreskin [amazingkreskin.com] to predict Humanity's future. The hand writing is on the wall: Humanity faces a bleak future. In fact there won't be any future at all for Humanity because Humanity is dying. Things are looking very bad for Humans. As many of us are already aware, Humanity continues to lose market share. Blood flows like a river of red ink.

    "Smart People"(tm) are the most endangered of them all, having lost 93% of its core reproducers. The sudden and unpleasant departures of long time people Stephen King and Feynman only serve to underscore the point more clearly. There can no longer be any doubt: Humanity is dying.

    Let's keep to the facts and look at the numbers.
    Human watchdog organisation BBC states that there are around 42,140 nuclear warheads poised to annihilate Humanity . How many People are there? Let's see. The number 6,382,978,111 was given by http://www.census.gov/cgi-bin/ipc/popclockw. Therefore there are about 6,383,000,000 humans. Therefore there are about 6,400,000,000 people. A recent article put China's population at about 20 percent of the world population. Therefore there are about 1,261,832,482 chinnese people. This is consistent with the number of people in china.

    Due to the troubles of world politics, abysmal birth rates in Japan and Italy, germ warfare, natural plauges, famine, and so on, people are largely screw. Now more people are dead, and with the death rate holding at a steady 100% there's little hope.

    All major surveys show that Humans are pretty damn stupid. Humanity is very sick and its long term survival prospects are very dim. If Humanity is to survive at all it will be through space travel. Earth continues to decay. Nothing short of a miracle could save it at this point in time. For all practical purposes, Humanity is dead.

    Fact: Humanity is dying
    [ Parent ]
  • 32 replies beneath your current threshold.