Slashdot Mirror


BSD Hacks

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. BSD Hacks author Dru Lavigne pages 427 publisher O'Reilly & Associates rating 10 reviewer George ISBN 0596006799 summary A great array of hacks you can perform on your BSD box, many applicable to all the BSDs, including FreeBSD, NetBSD, OpenBSD and Darwin/OS X.

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.

12 of 122 comments (clear)

  1. fp by Anonymous Coward · · Score: -1, Offtopic

    fuck you all

  2. FreeBSD vs Linux -- check it out by Anonymous Coward · · Score: -1, Offtopic

    FreeBSD vs Linux - The Definitive Comparison

    Flamewars between FreeBSD and Linux advocates occur all the time, so it's often hard to make a judgement. Our 500-employee company recently decided to convert fully to Open Source software and OSes; I was put in charge of making the decisions. It boiled down to FreeBSD and Linux, and without letting any bias or emotions get in the way, I established the following criteria.

    Performance

    This is a complicated issue, so let's consider these three types of machine (in use at our company):

    Single CPU server: FreeBSD just edged ahead of Linux on this one. The differences weren't drastic, but large enough - consequently, score 1 for FreeBSD here.

    Multi CPU server: With kernel 2.6, Linux performed considerably better than both FreeBSD 4.9 and 5.2.1. The updated SMP code and revised scheduler have worked wonders here, so 1 for Linux.

    Desktop: Linux 2.6 is much faster than either FreeBSD, particularly when the system is heavily loaded. Application start times are slightly better, while responsiveness is remarkably superior to FreeBSD. Another 1 for Linux.

    Result: FreeBSD 1, Linux 2

    Stability

    Linux distributions vary greatly in terms of stability, with Mandrake Linux and Fedora Core aiming for bleeding-edge desktop features, while Slackware and Debian put great emphasis on stability. FreeBSD is indeed a reliable OS, but the smaller development and testing community puts it behind Linux - additionally, there are more full-time Linux developers working with commercial companies on hardware support and core component testing.

    Our Debian and Slackware systems have never crashed or suffered any other major glitches in five years of use, and we know of other individuals and companies that can say the same. With the correct distribution selection, Linux systems are extremely reliable. The far greater amount of testing by the community and companies gives Linux a boost here.

    Result: FreeBSD 0, Linux 1

    Support

    Ease of updating: Although a third-party binary updaing system exists, it's not yet part of the official FreeBSD system (and consequently, problems with trust occur). Current FreeBSD releases rely on manual CVS updating, patch applying, compilation and installation. Debian GNU/Linux, conversely, only needs a single command to update; this is a major win for Linux, as it saves a huge amount of time on a large number of machines. 1 to Linux.

    Length of support: Each FreeBSD point release is only supported for 12 months. The Debian Project supports each of its releases for over two years, and other distros such as Red Hat Enterprise Linux are supported for five years. Although upgrading FreeBSD is fairly simple, the changes in userland tools and Ports means that extensive re-testing of home-grown apps needs to be made. A major win for Linux here.

    Commercial support: FreeBSD is significantly weaker on this front, with Linux vendors offering a much greater range and variety of support contracts than are available for FreeBSD. 1 to Linux.

    Result: FreeBSD 0, Linux 3

    Hardware

    Server: FreeBSD's driver range for server-class machines is very good, and the drivers themselves are robust and well-tested. Linux is strong on this front too, but FreeBSD just pips it to the post. 1 to FreeBSD.

    Desktop: Linux far surpasses FreeBSD in terms of desktop hardware support, with a gigantic range of drivers and subsystems from both kernel developers and third parties. 1 to Linux.

    Other platforms: Debian supports more architectures than FreeBSD, although the gap is narrowing. NetBSD supports even more, but that involves throwing another BSD variant into the mix - this causes problems. 1 to Linux.

    Result: FreeBSD 1, Linux 2

    1. Re:FreeBSD vs Linux -- check it out by mnemonic_ · · Score: 0, Offtopic

      False!

    2. Re:FreeBSD vs Linux -- check it out by Short+Circuit · · Score: 1, Offtopic

      supported for longer

      So they've found a new way to hide "BSD is dying" in their trolls?

    3. Re:FreeBSD vs Linux -- check it out by bani · · Score: -1, Offtopic

      you are so very wrong.

  3. *BSD is dying by Anonymous Coward · · Score: -1, Offtopic
    It is official - Netcraft now confirms: *BSD is dying

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

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

    FreeBSD is the most endangered of them all, having lost 93% of its core developers. The sudden and unpleasant departures of long time FreeBSD developers Jordan Hubbard and Mike Smith only serve to underscore the point more clearly. There can no longer be any doubt: FreeBSD is dying.

    Let's keep to the facts and look at the numbers.

    OpenBSD leader Theo states that there are 7000 users of OpenBSD. How many users of NetBSD are there? Let's see. The number of OpenBSD versus NetBSD posts on Usenet is roughly in ratio of 5 to 1. Therefore there are about 7000/5 = 1400 NetBSD users. BSD/OS posts on Usenet are about half of the volume of NetBSD posts. Therefore there are about 700 users of BSD/OS. A recent article put FreeBSD at about 80 percent of the *BSD market. Therefore there are (7000+1400+700)*4 = 36400 FreeBSD users. This is consistent with the number of FreeBSD Usenet posts.

    Due to the troubles of Walnut Creek, abysmal sales and so on, FreeBSD went out of business and was taken over by BSDI who sell another troubled OS. Now BSDI is also dead, its corpse turned over to yet another charnel house.

    All major surveys show that *BSD has steadily declined in market share. *BSD is very sick and its long term survival prospects are very dim. If *BSD is to survive at all it will be among OS dilettante dabblers. *BSD continues to decay. Nothing short of a miracle could save it at this point in time. For all practical purposes, *BSD is dead.

    Fact: *BSD is dying

    1. Re:*BSD is dying by Eradicator2k3 · · Score: 0, Offtopic

      Uh-huh-huh-huh-huh-huh-huh

      He said "Penetrated."

      --
      Mr. T pitied this fool on 27 July 1992.
  4. Dhume 3 on BSD.... by Anonymous Coward · · Score: -1, Offtopic

    OMFG have you seen the Doom 3 trailer it's like slow and it's telling you all the stuff you did in the first one then the music kicks in and and the chief comes out and gets a gun the earf is on fire and chief is like fuck this im jumping and HE JUMPS PUT OF TEH SPACESHIP with angels singing and he lands on the bad guys and that annoying ai lady is like GO GET EM TIGER! WILDCAT IS ON TEH SPOKE!!!~`1 and theres less polys but rawkin bumb mappings you can view this on a special MICROSOFT xbox disk that comes with EB games store.

  5. Rocky-Road Icecream is DEAD! by Anonymous Coward · · Score: -1, Offtopic

    Rocky-Road Icecream is DEAD!
    Everyone knows that Orange Sherbert icecream is better than Rocky-Road icecream.
    You can ask anyone who works in an icecream shop, everyone wants Orange Sherbert!
    If you eat Rocky-Road icecream, then you are a necropheliac because Rocky-Road icecream is dead!
    Everyone knows that Orange Sherbert icecream is superior. Rocky-Road icecream eaters are morons.
    Even the people who make Rocky-Road icecream know that their days are numbered. They don't sell as much icecream as the Orange Sherbert icecream makers.

  6. OK, but... by Anonymous Coward · · Score: -1, Offtopic

    Where is my FUCKING SCO story?

  7. Expel the Daemons by Anonymous Coward · · Score: -1, Offtopic
    Pat Robertson talks about the law of reciprocity in his Secret of Financial Prosperity. The theory is that if you give money to God's work, God will return it to you many times over through pay raises, successful investments, and so on.

    Many folks who want to benefit from the law of reciprocity contribute each month to the 700 Club. I would recommend that you start watching the 700 Club on you television and decide for yourself it it is for you.

    God wants you to be prosperous. A popular book titled The Prayer of Jabez shows you how to claim the prosperity which God holds in store for you. Your library might have a copy. It is definitely worth a read.

  8. Netcraft: Linux trolls are dieing by Anonymous Coward · · Score: -1, Offtopic

    Netcraft confirms it, Linux trolls are dieing. Slashdot's clique of giggling/conspiring school girls, Linux trolls harp over minor issues in windows as they ignore huge, gaping holes in Linux. Like a dog in heat humping an uncomfortable human's leg these unfortunate souls believe that if they just push hard enough, they can fuck the whole world before they lick their own groin.

    Sad Trolls

    While pretending to run or in some cases actually even running the now defunct operating system these trolls post hypothetical flaws of windows that they don't even understand. While attempting to convince potential users that the incredible inconvenience of Linux is worth the negligible advantage of Open Source Software they cite 'facts' that make one wonder if these trolls have ever even used a computer, much less Linux.

    One thing is clear:Linux trolls are dieing.

    Asia

    Home to 3 trillion people, Asia was seen as a possible breeding ground for Linux use thanks to its widespread poverty and poor hygiene. This potential coup for Linux was averted, however when Microsoft entered into a rampant piracy agreement with the people of Asia worth an estimated -$34,000,000,000.

    Global Ramifications

    As a result, the proponents of this hard to use and poorly designed operating system have had to resort to sad measures. The most common is the "pretend to know Linux by mocking Windows trolls while really not even knowing either operating system well" troll. While usually guaranteed to garner some mod points, these trolls have been called out of late by a group of Windows trolls who know they are full of shit.

    The fallout over the hivemind mentality of these sad and confused youngsters has led to the collapse of what was once a glowing beacon to trolls everywhere. Once held up as a symbol of individuality and defiance of the rules, Linux trolls have now been associated with the very conformists they purport to despise. These people that say whatever will make them look cool at the time threaten the already iffy credibility of true Linux trolls.

    Fact: Linux trolls are dieing.