BSD Hacks by Dru Lavigne This errata page lists errors outstanding in the most recent printing. If you have technical questions or error reports, you can send them to booktech@oreilly.com. Please specify the printing date of your copy. This page was updated February 23, 2007. Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem ?page-number?: reader question or request for clarification Confirmed errors: {xi} 1st hack attribution; Michael Vince should be attributed to hack #66, not #64 as listed. (6) example after 3rd paragraph; The setting of prompt is defined in the example as follows: dru@~:grep prompt ~/.cshrc if ($?prompt) then set prompt = "%B%n@%~%b: " I.e., a space should be inserted between the last ":" and the text user will enter. However, in the examples in [Hack #2] and [Hack "3], no space is inserted. A space should be inserted after ":". I.e., dru@~:grep prompt ~/.cshrc should become dru@~: grep prompt ~/.cshrc (5) "Silencing Auto-Complete" 2nd paragraph; a prompt missing. ls -l b should be: % ls -l b [15] 2nd paragraph from bottom; The command: % xbindkeys --defaults ~/.xbindkeysrc should be: % xbindkeys --defaults > ~/.xbindkeysrc {23} 2nd paragraph from the bottom; set autologout = (30 15) This particular setting will log out a user after 15 minutes of inactivity. ^^^^^^^^^^^^^ The portion "log out a user" should be "lock the screen" because the second parameter is 15. (24) See Also of Hack #7; The second line of See Also looks: man tcsh man idled These should be separated into two lines. {27} 5th line from the bottom; The example to remove files from trash should not be: % \rm /trash/* instead, it should be: % \rm ~/.trash/* (31) 2nd line from the bottom; The next two files work hand in hand and customize the behavior of man mail. Should be: The next two files work hand in hand and customize the behavior of mail. (34) 2nd and 1st paragraphs from the bottom; The FILES=1 and FILES=2 in each paragraph should be FILES1 and FILES2 respectively (45) "Multitasking with Screen"; -s should be -S. It occurs twice on page 45, once in a listing and once in the paragraph before the listing. (66) last line; print """Change text file delimiters. (The book is missing several lines of documentation and the closing triple quote.) it should say: print """Change text file delimiters. This script copies a text file that is space delimited with text values in double quotation marks to a new, tab delimited file without the double quotation marks. The advantage of using this script is that it leaves spaces that were within double quotes unchanged. There are no command line arguments for this script. The script will prompt the user for source and destination file information. You can redefine the variables for the original and new delimiters, delim and new_delim, in the script as needed.""" (67) 7th line; The comment: #The variable 'm' acts as a text/non-text switch that reminds python should be: #The variable 'tswitch' acts as a text/non-text switch that reminds python Also, in the middle of the page; the 4 occurances of "==" there should be no space between the "=". ----- The correct code, in its entirety, is below: #!/usr/local/bin/python import os print """ Change text file delimiters. This script copies a text file that is space delimited with text values in double quotation marks to a new, tab delimited file without the double quotation marks. The advantage of using this script is that it leaves spaces that were within double quotes unchanged. There are no command line arguments for this script. The script will prompt the user for source and destination file information. You can redefine the variables for the original and new delimiters, delim and new_delim, in the script as needed.""" # Ask user for source and target files. sourcefile = raw_input('Please enter the path and name of the source file:') targetfile = raw_input('Please enter the path and name of the target file:') # Open files for reading and writing. source = open(sourcefile,'r') dest = open(targetfile,'w') # The variable 'tswitch' acts as a text/non-text switch that reminds python # whether it is working within a text or non-text data field. tswitch = 1 # If the source delimiter that you want to change is not a space, # redefine the variable delim in the next line. delim = ' ' # If the new delimiter that you want to change is not a tab, # redefine the variable new_delim in the next line. new_delim = '\t' for charn in source.read(): if tswitch == 1: if charn == delim: dest.write(new_delim) elif charn == '\"': tswitch = tswitch * -1 else: dest.write(charn) elif tswitch == -1: if charn == '\"': tswitch = tswitch * -1 else: dest.write(charn) source.close() dest.close() (76) Note; "Even though nbtstat ? indicates..." should be: "Even though nbtstat /? indicates..." (79) last word, first line in the paragraph before daily_clean_tmps: change /var/log/messages.1.bz2 to /var/log/messages.0.bz2 (80) The last line of page 80; .... see (ex)1 The "(ex)1" should be "ex(1)". {84} about half way down the page; Change: md /tmp mfs rw,-s64m i 2 0 ... to: md /tmp mfs rw,-s64m i 0 0 (109): The 2 syslogd lines in "Setting Up the Logging Server" should read: syslogd_enable="YES" syslogd_flags="-ss" (114) example after 1st paragraph; The 5th line of this output example is: I'm a node in cyberspace. Who are you? ^ but, the setting example found at the 9th line from the bottom of previous page 113 is: ... I'm a node in Cyberspace. ... ^ (136) 1st - 2nd line from the bottom; We briefly saw this file in "Customize the Default Boot Menu" [Hack #24] when we ... should be: We briefly saw this file in "Protect the Boot Process" [Hack #25] when we ... (139) 1st paragraph of section "/etc/login.conf"; I read: ... in our old friend /etc/login.conf [Hack #30] but, /etc/login.conf is seen in [Hack #29], not in #30. 152: "% sshd -l rembackup 10.0.0.1" should be: "% ssh -l rembackup 10.0.0.1" (174) 1st paragraph of section "Spoofing on NetBSD"; It says that Dheeraj Reddy's ifconfig patch is available from http://news.gw.com/netbsd.tech.net/%3C20030808072355.GA616%40bharati.sudheeraj.net%3E, but this URL no longer exists. I find this patch is available from http://mail-index.netbsd.org/tech-net/2003/08/08/0001.html [174] 3rd line from the bottom of the page; The example command of applying patch is shown as follows: # patch > ifconfig.patch it should be: # patch < ifconfig.patch (178) 1st - 2nd line of "shome" section of the example code; It reads: ifconfig ${NIC} inet 192.168.1.21 ssid "myhome" authmode "shared" nwkey 0x123456789a netmask 255.255.255.0 The second line is continued from the first line since "nwkey" is option of ifconfig command. Therefore, "\" is necessary at the end of the first line. (185) 6th paragraph; I read: You can also fine-tune that syntax to unidirectional traffic like so: # tcpdump -i ed0 src host genisis and dst host server1 That will show only the traffic that was created at genesis and ... ^^^^^^^ This "genesis" should be "genisis" (203) fourth line; instead of # make restart-msp it should be # make restart-mspq (213) last paragraph; Change the last paragraph and listing on p. 213 to: Set an environment variable to tell ClusterIt where to find the list of hosts, and set two more to specify ssh as the tool to start remote shells and terminals. Run this from the tcsh command line or add the commands to your ~/.cshrc: setenv CLUSTER ~/.cluster setenv RCMD_CMD ssh setenv RLOGIN_CMD ssh (240) 2nd paragraph of Hack #58; I read: ... you already have the mtree utility [Hack #54] but, mtree is explained in Hack #22. (246) last paragraph; # /usr/local/ports/security/snort Should be # /usr/ports/security/snort (248) 4th paragraph; /usr/local/etc/apache/httpd-conf should be /usr/local/etc/apache/httpd.conf (258) last paragraph; (make sure the directory /etc/cgd exists and is mode 600): should be (make sure the directory /etc/cgd exists and is mode 700): (261) 4th item of "See Also" in Hack #60; It reads: The Encrypting Disk Partitions (using gdbe) section of the FreeBSD Handbook it should be: The Encrypting Disk Partitions (using gbde) section of the FreeBSD Handbook (266) last paragraph; Both paths in the last paragraph should be changed. it should be: ...renaming /usr/local/etc/rc.d/sudoscriptd.sh.sample to /usr/local/etc/rc.d/sudoscriptd.sh. (270) 3rd paragraph; I read: .... if you're using rsnapshot for backups [Hack #35] But, rsnapshot was explained in Hack 39, instead of Hack #35. (280) Example Usage; The script list my three Ethernet cards, rl0, xl0 and rl0 should be: The script list my three Ethernet cards, rl0, xl0 and rl1 (284) 4th code block (3rd full code block); /.quickpatch.pl should be: ./quickpatch.pl (290) last line; The last line introduces the URL for ClamAV is http://clamav.elektrapro.com/ It has changed to: http://www.clamav.net/ (308) 1st paragraph of section "Using the Live Filesystem"; The introduced ftp path: ftp://ftp.freebsd.org/pub/FreeBSD/ISO-IMAGES/5.1-RELEASE/ is now seems to be changed to: ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/ISO-IMAGES/5.1/ (313) 1st - 2nd line; The introduced URL for Netcat web site http://www.atstake.com/research/tools/network_utilities does not exist now. Instead, I think following is the appropriate URL http://netcat.sourceforge.net/ (341) fastest-cvsup should be fastest_cvsup in both the listing and the paragraph that occurs before the listing. (343) n the script under echo "Updating docs"; "cd /usr/ports" should be "cd /usr/doc" Note that the "cd /usr/ports" IS correct under echo "Updating ports index" (348-349) cvs checkout command Please remove the -l from the "cvs checkout" command on pages 348-349. (352) 2nd paragraph and more in this page; The four file names ".ctm-status" in this page should be replaced with ".ctm_status". (376) 2nd paragraph, last line; SH. NAME should be: .SH NAME (390) 4th paragraph; The word "psuedoterminal" should be "pseudoterminal". (392) 2nd paragraph; According to the output of lastcom above this 2nd paragraph, the user name dlavigne6 should be dlavigne. (396) last example; % grep -wi 't...k...r' /usr/share/dict/words/ should be: % grep -wi 't...k...r' /usr/share/dict/words (400) 6th paragraph; The following URL is introduced to download Latte Diablo JRE 1.3.1: http://www.freebsdfoundation.org/cgi-bin/download.cgi?package=diablo-jre-1.3.1-0.tar.bz2 it should be: http://www.freebsdfoundation.org/cgi-bin/download.cgi?package=diablo-jre-1.3.1.0.tgz [405] 2nd paragraph; "tail -f -b=1m ports.tar.gz | tar -zvxf ports.tar.gz" should be "tail -f -b 2048 ports.tar.gz | tar -zvxf -".