...making Linux just a little more fun!

<-- prev | next -->

More 2 Cent Tips

See also: The Answer Gang's Knowledge Base and the LG Search Engine


About crypt function in Linux -- Easy Encryption

Tue, 7 May 2002 15:52:47 -0400
Marko Cehaja (internut from thetaworld.org)

(with minor editing by Ben Okopnik)

I have many files on my hard disk which are important and need to be encrypted. Once, I left my computer at a client's location while working on their database, and they tried to crack into it. They got in with a SuSE boot disk and installed FTPD so they could grab my files. The only reason they failed was because they didn't know how to crack a plain PostgreSQL database (which should be simple when you're logged in as root). Since then, I don't leave any important data un-encrypted in order to be ready for such incidents.

Since I often use Midnight Commander, I have automated this by creating a menu item in its menu file (~/.mc/menu) [ Note: This can also be done via MC's pull-down menu system - press "F9", select "Command", then "Menu File edit". ] The following entry will pack the entire current directory and encrypt the result with GnuPG.

See attached encryptdir-gpg.midnight-commander.txt

I've also added an entry for single file encryption:

See attached encrypt1file-gpg.midnight-commander.txt

What if the files are already encrypted? In order to save some time, I have put following into the extension file located at ~/.mc/bindings [ Note: 'F9', "Command", "Extension File edit" via the pull-down menu. ]

See attached view-gpg.midnight-commander.txt

Now, when you press F3 (view) on the file with extension *.gpg, it asks you for the passphrase and shows the contents of the file. Beware, however: if you are on the network or on a multi-user system, your memory and swap file (which contain the decrypted text) could be exposed to attackers.

One good use for this is to put all your passwords into a single file, and simply remember one passphrase. Be sure to remove the original plain text files with "wipe" or "shred" rather than "rm" to delete data in a secure manner.


Adding PHP to apache on Redhat 9.0

Sun, 30 Nov 2003 16:45:31 +0200
Raj (The LG Answer Gang)
Question by Francis Matsika (fmatsika from zdb.co.zw)

I have just installed redhat 9.0 and i am wondering how to configure or build php as an apache module

I installed apache and php using rpm's that come with redhat 9.0

[Raj] If you used RPMs it has already been installed. Create a file in your /var/www/html/ directory (say self.php), and put this lines into it
<?
phpinfo()
?>
Point your browser to it, (usually by saying http://127.0.0.1/self.php in your browser) and you will have everything you never wanted to know about your PHP module in front of your eyes.
[Thomas] You miss the point completely here. The question was not "how can I test php"; it was "how can I get apache to utilise it". The answer to that question is that the RPMs should have already sorted that out for you, Francis. You'll just have to enure that you:
apachectl restart
[Raj] Just another example why speed reading is bad for health :). Francis, as Thomas pointed out, if you have used RPMs for installation, then everything has already been taken care of. However, if you want to be sure that good old rpm has not cheated you out what is rightfully yours, then check for the following files.
The main workhorse for translating the php code into html: /etc/httpd/modules/libphp4.so
The file which controls how PHP behaves while interpreting php files: /etc/httpd/conf.d/php.conf
Controls quite a few other PHP features, like security, language options etc. Very well commented: /etc/php.ini


automatic backup in debian

Sat, 06 Dec 2003 13:53:41 +0530
Thomas Adam (The LG Weekend Mechanic)

I am a newbie debian user (switched from RH). I have faced a strange prob. in woody. whenever I modified any file the previous contents is backedup with a *~* sign and the modified one is saved with the actual name. like *test.kwd* will be *test.kwd* after modification, but there will be an extra *test.kwd~* also.

plz suggest me how to stop the generation of this second back-up file.

thanks in advanced

[Thomas] Well, yet again Joydeep, I am being poisoned with LOIS (Lack Of Information Syndrome) --
I am going to make an intelligent guess and assume that you are using vi (or in your case vim).
Vim will save backup files, using the caret (~) notation. You can add the following to your ~/.vimrc file:
:set nobackup
to disable it (in the configuration file the leading ':' is optional).
Of course, if you are not using vi[m] then that means we need to find an alternative solution -- something drastic I think, like:
cd / && find . -name '*~' -exec rm -f {} \;
You can then add this as a cron entry to run say every 20 minutes?
0-59/20 * * * * some_user  cd / && find . -name '*~' -exec rm -f {} \;


Bash Scripting

Sat, 7 Jun 2003 11:45:35 -0400
Faber Fedor (The LG Answer Gang)
Question by Robin Chhetri (robinchhetri from fastmail.fm)

Hi Gang,

I asked another question around one month ago and even though I could not come up with a answer I decided to come up here again.(Incidentally I tried it also in linuxquestions.org).

What would be the equivalent to the zsh script given below in bash

$echo ${${(z) $(whereis libcrypto)}[2]}

if the output of $(whereis libcrypto) is

libcrypto: libcrypto.so libcryto.a

it returns libcrypto.so only. Now I could come up with

$robin=($(whereis libcrypto)); echo ${robin[1]}

But can it be done in one go using some construct? I am not a shell guru so I wonder if it can be done!

[Faber] I must be missing something. If you simply want to print to STDOUT, try this:
$( whereis libcrypto | awk '{print $3}' )
which will print to STDOUT. If you simply must put it into a variable, then:
$robin=$(whereis libcrypto | awk '{print $3}') ; echo $robin
is the shortest way I know of, but that isn't saying much.


I need help, PLEASE!

31 May 2003 08:43:04 +0530
supreet (supreet from linux-delhi.org)
With comments by Heather Stern (the Answer Gang's Editor Gal)

Well if you need dos boot disks. visit www.bootdisk.com.

It has nice pointers to many flavors of boot or install disks for the various mswin, a notable floppy-linux or two, and the correct HOWTO out of TLDP for finding the major distros' floppy images. -- Heather

Debian's first installer CD can allow access to a prompt, as can several other distros.

Expect to need to press ALT-CTRL-F2 or another F key to leave the curses or GUI installer page and find a shell, then poke around mounting up your partition and chroot'ing in.
Some even allow starting a "rescue shell" tho beware this claimed feature does not work in all red hat flavors. -- Heather

Then you can load your boot-loader.

Supreet


Help (Networking)

Wed, 9 Jul 2003 13:49:25 +0100 (BST)
Thomas Adam (The LG Weekend Mechanic)
Question by sivagnanam munusamy (searchsiva from rediffmail.com)

hello sir,

i am sivagnanam and i completed B.E.,(Computer science)in University of Madras at tamilnadu in India.

i did some projects in Linux platform. i would like to know about GRUB loader details ,NFS and DHCP.

please help me.

with regards,
sivagnanam

Hello Sivgananam,

I've forwarded this reply to the Linux Gazette...

You have supplied me with VERY little information to go on, but I will try and help you...

GRUB (GRand Unified Bootloader), is a GNU bootloader. It offers an interactive shell in which to configure it. I actually dislike GRUB immensly and prefer the defacto "LILO" loader, although many distributions now use GRUB as their default, alas.

The FAQ can be found here:

http://www.gnu.org/software/grub/#TOCfaq

I find the config file confusing, and terse (cf: "man tar" - perhaps the heaviest man page of them all).

NFS is Network FileSystem, and I use this extensively via PLIP (which is a Paralell Line IP), which allows you to mount another computer's FS over a network.

DHCP is a means of automagically having a machine assigned an IP address.

All of these can be found in the LG KB, at:

http://www.linuxgazette.net/tag/kb.html

-- Thomas Adam

By far the most popular reason, in my opinion, is that GRUB takes nice high resolution pictures, while LILO only handles cruddy resolution of 640x480. Which probably means that its graphics work on more systems, but gosh, it'd be nice to have the option. If the code costs too much space though... maybe grub is bigger. -- Heather


Linux Hotplug for Dummies

Mon, 12 May 2003 18:57:17 -0400
Robos (the LG Answer Gang)
Question by dokhebi (dokhebi from earthlink.net)

I've tried reading all of the documentation for Linux Hotplug that I can find, and none of it seems to answer my questions; A lot of it referes to other documentation that goes off the main topic, and there is nothing that describes the format of the usb *mapfiles, or how to set up the auto-mounting of a specific device (in my case a SanDisk Cruzer) What I really want is a step-by-step configuration guide or a "Linux Hotplug for Dummies" type of book

Thanks,

Edward Hooper

Well, can't give you that but you reminded me that I wanted to look into this myself. Here is what I've found so far:

If you plug something into the usb port (that is what most of the time hotplug is for, in the future firewire and maybe pci hotplug will also come into the game) the kernel does something and then something else does something (in the flux, 2.5 is different than 2.4 and I really didn't get it since it didn't interest me) and then hotplug comes into the game. There are config files under /etc/hotplug (at least thats the place with debian): usbusb.distmap, usb.rc, usb.agent and usb.handmap. usb.agent and usb.rc are for hotplug itself and the interesting parts are distmap and handmap. Dunno for sure what handmap is for (devices where modprobe doesn't know what to do?), but in distmap are the devices and their name equivalents in the form idVendor idProduct and so forth. I have a usb memory stick which gets handled like this: scsi emulation needs to be there (sd_mod) usb-core needs to be there (obviously) usb-storage needs to be loaded (since the stick is storage) and maybe the right fs modules like vfat, msdos or whatever then the thing gets mounted like this mount -t auto /dev/sda1 /mnt/usbstick

OK, now to put this into the scripts hotplug can handle: I searched google and found some german LUG that had written some scripts already. I adapted this for my use. Here it is. Save the file as /etc/hotplug/usb/usb-storage:

See attached usb-storage.sh.txt

Now for a little (newbie-ish) explanation. The set >> thing writes the variables that get set by the kernel thingy to /tmp/usb-storage-variables. Take a look into that,

PRODUCT=c76/5/100

and

ACTION=add

are important and maybe

DEVFS=/proc/bus/usb
DEVICE=/proc/bus/usb/001/007

too.

The echo marks simply where one insert ends and the next starts. If the variable ACTION is add the next case is triggered which checks if the product id is c76/5/100. This is my usbstick. Since I want to have this script also for my girlfriends stick I need to destinguish between them. If it is my stick ($PRODUCT is c76/5/100) then it gets mounted.

If you unplug it the script should be run again if I understand it correctly, but this doesn't seem to happen. ACTION=remove never appears.

I want to make it like this later on: a usb-hub connected to our server (in my apartment-sharing community) where you plug in your usb stick upon entrance. Then this gets mounted and the other computer you turn on mounts that from the server and loads e.g. mozillas bookmarks from the stick. If you trigger a serial mouse button (very handy that they have 3 buttons mostly - 3 ppl in the community) the corresponding usb stick should then get unmounted and you can leave the house.

Not a book Edward, but I hope sufficient for the beginning.

Cheers Robos


He did write me this back. I keep it in the TAG for now, maybe someone knows something here (although I think most of the ppl here rather like doing things by hand) Quote Edward:

I've been able to scope this much out, but I don't like the idea of hard coding the device (/dev/sda1) because I can't be sure that it will always be that device. What if this is the second usb-storage device I plug in? What if I decide to add more SCSI devices (my main system has an Adaptec AHA-2940UW with 7 devices already) and I don't change the script? Is there a way to get the device node from the known info? In other words, is it encoded in /proc/bus/usb/xxx/yyy and I can extract it?

Well, it says in the docs (linux-hotplug.sf.net or something) that device info (in $DEVICE) is in 2.5....

Now that 2.6 has released, The Wonderful World of Linux 2.6 in this issue mentions how hotplug has been improved. -- Heather

I think the /proc/ stuff can be used for assigning to the right device, but sort of hard to do with only one stick. Later my flat mate comes back and I can test with his stick too, then I can tell you more.

I don't want to say this, but for all of Microsofts many faults, they can at least auto mount without having to go through all of this shit. I think it's time for the kernal hackers to wake up and smell the coffee, because Linux will not be ready for the desktop until it can do want M$ can do, but better, faster, and cheaper.

If you rely on the kernel hackers there you are sort of lost. They are already having fun hacking the kernel, they don't need anything more. And this is no longer a kernel-space thing: the kernel informs you already where and what (if we think /proc is the right thing) but there are simply not the userspace tools. The usb-stick phenomenon is just coming up really fast right now ...

Actually, this tip escaped proper mention a few months ago, and I dug it out of storage. However it seems he is correct; flash chips, memory sticks, and "thumb drives" have become amazingly popular. -- Heather

...and up to now this wasn't necessary. As for scsi hotplug, this is simply rare.

I will mail later if I figured something out.

Cheers Robos

Thanks for the info so far,

Edward Hooper


Covert HTML attachments to PDF at mail server

Wed, 03 Dec 2003 16:54:38 +0800
Thomas Adam (The LG Weekend Mechanic)
Question by Steven Lockhart (linuxoz from yahoo.com.au)

For security reasons I would like to convert all incoming mail attachments from htm/html to pdf. ( a procmail, ghostscript, ripmime, altermime ) or whatever it takes solution.

I am sure a lot off mail server sysops would love to do this.

Any ideas would be appreciated

[Thomas] For security reasons (and sanity reasons for that matter), you should really be sending all MIME-encoded e-mail to /dev/null. It is more likely that if you were to do a conversion that you'd only be translating spam into Yet Another Medium (tm), so why bother?
Doesn't mean we won't answer him, mind you. I chime in here to warn that just because HTML to PDF tranlators currently ditch javascript bugs and various browser-bug exploits, that someday the PDF internal scripting language may grow fancy enough to do some pretty strange things. Luckily at the moment, PDF's a pretty nice "destination = paper" kind of format. -- Heather
[Thomas] Yep -- again this depends on which filtering tool you would like to use. Personally, I find procmail the easiest, but that might not necessarily suit your needs.

I am sure a lot off mail server sysops would love to do this.

Nope, not me. Here's one possible solution (note: not tested).
# Is it html?
:0:
* ^Content-Type:.*html
| html2pdf /some_location/yum.pdf
Probably you want to use some tricks to create a reasonable filename that won't be overwritten constantly (if there's only one, message ID ought to do, with .pdf tacked on the end) and you might need to use a MIME decoder to pull off the portion which is the actual HTML portion. After that, the trick should be usable for other "readable" attachment types you feel like converting for sanity, e.g. quoted-printable to your local character set, etc. You'll need to handle each file format seperately, unless you have a converter that's smart enough to figure out the filetype on its own. -- Heather


Securing a dial in?

Sat, 28 Jun 2003 22:15:44 -0500 (COT)
John Karns (the LG Answer Gang)
Question by George Morgan (George_Morgan from sra.com)

Hello answer guy,

I need to be able to secure an external modem that has been connect to a Solaris box to protect against unauthorized calls.. What I mean is that I want to be able to allow people to connect to the box based purely on the phone number they are calling from. Is there a way on the modem to only allow certain calls to go through while rejecting all other calls?

See the "mgetty" open source pkg (http://alpha.greenie.net/mgetty). It offers this capability, provided that your modem line has caller id. The pkg includes pretty good documentation as well as good example cfg files.


linux printing

Mon, 15 Dec 2003 01:22:56 -0800 (PST)
Heather Stern (The Answer Gang's Editor Gal)
sanjoy patra (sanjoy_cal from yahoo.com)

i have one redhat 8.0 linux server and hp1200 laser printer is attached with this.i want print from other linux box on same network.printer is printing from server ok and also it is printing from windows m/c on same lan but it is not printing from any linux box

[Heather] First thing, thanks for writing to The Answer Gang.
Secondly, you may not be aware of the resource, but there's this great site about printing support for Linux called linuxprinting.org. You've gotten you printer working for at least a couple of machines though, so perhaps you've already been by there. If not, check it out :)
So that leaves the nitty gritty good stuff. I'm guessing the topology is like this, but if it's different, please describe how things are really connected:
 printer[hp1200] ==/parallel/== RH8 --------- other linux boxes
                                samba
                                |
                                windows box
Usually in order to be a printer client, Linux boxes have to be running something small to make the connection. lpr with their only printer pointed at the big RH box as a remote printer, for example.
rlpr might be a fast thing to try on one of them.
Please advise if you're using CUPS or lprng. While the general answer (make sure the clients know who the printer is and have the protocol loaded) is the same, the details of the answer are quite different. And the docs at linuxprinting.org may be handy indeed.


Loads of Linux Links

Mon, 29 Dec 2003 11:41:25 -0800 (PST)
Barbara E. Irwin (beirwin from shaw.ca)

I am one of the contributors for the Loads of Linux Links project (http://loll.sourceforge.net/linux/links/index.html).

FYI, this is a GPLed database of 4000+ subject-classified, searchable, and important Linux and Open Source links for all levels of Linux users. It was originally a project started for the Victoria Linux Users' Group and is now hosted by SourceForge.

Barbara


How can you find the correct /dev/hd?? for the C: drive

Thu, 04 Dec 2003 17:18:39 -0500
Neil Youngman (The LG Answer Gang)
Question by Michael Brusnahan (michael from commsoftware.net)

Hello

The install for mulinux cannot find the download files. After the boot command there is a message about /dev/hda?. My pc has two hard drives with 4 drive letters C, D, E, F C, E, F are 2 gig partitions on 1 drive D is a 4 gig drive

The boot command cannot find the C:\mulinux directory with the install files. It seems the C drive is not /dev/hda1. I have tried hda2, hdb1, hdb2 etc.

Would you know how I can find out the correct /dev/hd?? for the PC?

Thanks

-- mb

[Neil] Normally it would be /dev/hda1, however if it is a scsi disk, it could be /dev/sda1.
You may also find an answer at
http://www.tux.org/pub/distributions/tinylinux/mulinux/faq/faq.html
We don't have enough information to give a really helpful answer, see http://linuxgazette.net/tag/ask-the-gang.html for hints on how to help us help you.


Combining multiple PDFs into one

Thu, 5 Jun 2003 21:41:52 -0600
Jason Creighton (The LG Answer Gang)

#convert ps files to a pdf file
system $GS, $GS_ARGS, $filelist
and die "Problem combining files!\n";

This did not work no way, no how. I kept getting "/undefinedfilename" from GS no matter how I quoted it (and I used every method I found in the Perl Bookshelf).

Hm. I didn't try it, but -

perl -we'$a="ls"; $b="-l"; $c="Docs"; system $a, $b, $c and die "Fooey!\n"'

That works fine. I wonder what "gs"s hangup was. Oh, well - you got it going, anyway. I guess there's not much of a security issue in handing it to "sh -c" instead of execvp()ing it in this case: the perms will take care of all that.

The problem is probably that $GS_ARGS and $filelist are both strings with multiple arguments in them: Since you're calling system() with more that one arg, (bypassing /bin/sh) splitting the command line into words is your responsibility.

Oh, duh. Thanks, Jason; my brain musta been out on loan that day. You're right, of course.

# Convert string to list - TMTOWTDI, of course...
@a = split / /, "$GS -whatever -long -argument -string -follows";
system @a and die "Famine, sword, and fire! - $?\n";
If this isn't quite clear, some help from a handy script might work:
#! /usr/bin/env ruby

puts ARGV.inspect
(Actually, I could have witten this as "p ARGV", with does the same thing that I wrote here.)
Or, for those of you watching at home who haven't installed Ruby yet:
#! /usr/bin/env python

import sys
print sys.argv
Anyway, here's the script in action: (Actually, this isn't either of those scripts in action: It's a C version I wrote as a programming exercise. But it does the same thing.)
~$ putargs $(date)
[ "putargs", "Thu", "Jun", "5", "21:23:14", "MDT", "2003" ]
~$ putargs "$(date)"
[ "putargs", "Thu Jun  5 21:23:17 MDT 2003" ]
~$ putargs ls filename with spaces
[ "putargs", "ls", "filename", "with", "spaces" ]
~$ putargs ls 'filename with spaces'
[ "putargs", "ls", "filename with spaces" ]
~$ ls filename with spaces
ls: filename: No such file or directory
ls: with: No such file or directory
ls: spaces: No such file or directory
~$ ls 'filename with spaces'
ls: filename with spaces: No such file or directory
You see? The caller of a program does the splitting. And that means that if you want to call other programs, you have to do it too, or else your script will crash if somebody tries to use it on a filename with a character in it that the shell considers special, like a space or a star, because system() with one arg is calling /bin/sh behind your back.
So that's the main reason for bypassing /bin/sh: It gives you more flexibility with filenames: The "security risk" Ben keeps warning everyone about isn't, IMO, really the issue. It's just good style not to leave that sort of thing to the shell. Especially if your program is setuid/setgid.
Jason Creighton


what is "no"? (missing prog for binutils compile)

Thu, 29 May 2003 15:53:14 -0700
Faber Fedor, Karl-Heinz Herrmann (the LG Answer Gang)
Question by Jim Dennis (the LG Answer Guy)
with note by Alan Modra (binutils developer)

[K.-H.] Now -- it's an unbearable situation that my Linux doesn't know "no".... But I've no idea what it is and you can imagine that a google for "no" even with linux and some other keywords around are not very helpful.

Any ideas?

[Faber] Maybe it's called "nein" on your computer? <grvf>
I can't find a "no" on my Red Hat 8 box either.
[JimD] I think /usr/bin/no was (would be) a counterpart to the old /usr/bin/yes command:

See attached no.sh.txt

... so "no" could just be an alias or script that calls /usr/bin/yes with the "no" argument:
		 /usr/bin/yes no
I realize this sounds silly and stupid, and April 1st is long past for this year. But I'm not kidding. That Makefile (or whatever) seems to actually want to pipe an endless stream of "n" or "no" lines into some other process. (/usr/bin/yes was traditionally used in a pipeline with fsck to automate the process of repairing a filesystem that need lots of work -- then they just added the -y option to the GNU/Linux versions of fsck.

[K.-H.] I put the question up with bugreports for binutils and got:

[Alan Modra] /bin/sh: no: command not found
This is a result of binutils being stuck on using old buggy autoconf. Install a new version of GNU gettext, or configure with --disable-nls.
[K.-H.] Got a new gettext which includes some "no"'s
khh > find ./ -name "no*"
./gettext-runtime/po/no.po
./gettext-runtime/po/no.gmo
./gettext-tools/po/no.po
./gettext-tools/po/no.gmo
unfortunately with a new gettext (gettext-0.12.1.tar.gz) and nls enabled I get a linker error for some gettext symbol. The solution without nls works for getting binutils compiled.
K.-H.
He said he'd try it on the new kernels too, but we're not sure what his results were. -- Heather


Odd Behavior When First Launching Netscape Version 4.80

Sat, 7 Jun 2003 15:33:49 -0500
Chris Gianakopoulos (The LG Answer Gang)

Hello Gang,

I am now running the SuSE 8.2 Linux distribution on my main system. I use Netscape 4.80 for browsing my machine (locally) using Apache 1.3.27.

When first launching Netscape, followed by pressing the "Home" button, I would get a message indicating that a connection was being established to localhost. I would wait for a long time, cancel the connection attempt, try connecting to my host name (saturn in this case), and then connect to local host. Then the connection occurred immediately.

I searched the Web and found that something called asyncronous domain lookups are automatically enabled in Netscape 4.80 by default. Disabling this feature fixes my problem. Here is what I did.

edit the file, /usr/X11R6/bin/communicator, and place the following line in the file:

export MOZILLA_NO_ASYNC_DNS=True

I changed the environment variable in the above file rather than my .bashrc because I wanted this to take effect systemwide (and via the various tool buttons associated with my window manager).

So, this might be taken as a 2 cent tip.

Regards,
Chris Gianakopoulos


searching PDFs made from faxes

Tue, 01 Jul 2003 22:25:52 +0200 (CEST)
Karl-Heinz Herrmann (The LG Answer Gang)

Is anyone aware of a way to search PDF files that were created from faxes, e.g. tiff files?

I'm guessing that OCR has to be utilized here, right? I've come across things like pdftotext, but the fact that the PDF started life as a TIFF is, I think, a complication.

For the record, I'm putting together a fax server solution for a client. The ability to search the faxes for text strings would be killer.

your guess is quite right -- if the pdf contains only a large graphic and no actual text you would need ocr. gocr: http://jOCR.sourceforge.net

or claraocr:
http://www.claraocr.org

...might come in handy (gocr seems already trained while clara ocr is a quite different method). gocr produced reasonable results for me already 1 or 2 years back. BUT: I had clean 300dpi scans. From a jagged looking Fax..... I guess you are facing serious problems.

K.-H.


PerlHoo rocks

Thu, 11 Dec 2003 15:07:49 -0800
Rick Moen (the LG Answer Gang)

Some folks will have noticed me referring people to flat ASCII files I've squirreled away over the years on my Web server, usually inside http://linuxmafia.com/~rick/linux-info . While useful, this collection has always been (1) butt-ugly and (2) disorganised.

I've long realised I needed some sort of proper Web framework for all that material, and Rob Tougher's work updating the Gazette's HTML showed me how much improvement the addition of cascading stylesheets (CSS) can bring with only modest effort[1]. All of these thoughts came together when I ran across PerlHoo, a Yahoo-like Web directory system implemented in two simple Perl CGI scripts.

Please see: Description by author Jonathan Eisenzopf <[email protected]> in his series of three articles at Mother of Perl, http://www.webreference.com/perl/tutorial (recommended reading).

PerlHoo is simple, malleable, lightweight, fast (up to some thousands of documents per directory), and can point to URLs on or off your system. Its design limitations are:

If you need those things, there's a follow-on called PHPhoo. Personally, neither wanted nor needed them, and PerlHoo's exactly right for my needs.

There were two minor problems with Eisenzopf's design, as I found it in his most-recent (v. 1.1) tarball:

  1. Sucky URLs. PerlHoo indexes show up at CGI-synthesised virtual directory locations, e.g., http://linuxmafia.com/cgi-bin/perlhoo.pl/Apps for the Apps directory of PerlHoo's document tree. Finding a way to substitute something shorter for the "cgi-bin/perloo.pl" portion of those URLs would fix several things at once:

Fixing this required use of Apache mod_rewrite to make the undesirable patch element disappear, and a tiny bit of surgery on PerlHoo itself.

  1. Outdated and somewhat broken HTML. Eisenzopf's CGI-generated pages lack SGML DTDs, closing "body" and "html" tags, and the required "ul" pair to go with its use of "li" elements. The page relies upon setting specific colours by their hexadecimal identities, rather than using CSS. It also incorrectly used a nested "p" and "h3" structure to attempt physical markup. I've fixed all of these things, so that pages generated by perlhoo.pl are now CSS-oriented and pass the W3C validator as HTML 4.01 Transitional.

Just so other people don't have to reinvent those particular wheels, I've posted my modified and documented version of PerlHoo at http://linuxmafia.com/pub/linux/apps/ . The tarball includes full instructions on how to configure Apache, including mod_write .

My PerlHoo instance, "Linuxmafia Knowledgebase", can now be found at http://linuxmafia.com/kb .

To answer the other obvious question: Why, yes, of course I've gotten Ben Okopnik hooked. I'm no dummy! Ben says he's hacked PerlHoo separately to support individual stylesheets for each directory of PerlHoo's index, but I've not yet seen the results.

[1] One difference being that Rob has graphical design talent. I'm certainly not trying to denigrate Rob's excellent work.


previewing and printing text files

Tue, 17 Jun 2003 20:59:45 -0400
Ben Okopnik (LG Answer Gang)

There are lots of times when I want to print a text file but don't want to do it in the Default Ugly Courier font, or want to shrink, say, a page and a half down to a single page - and word processors are just too much bother for a simple font/size tweak. Here's a script that lets you pick font/size combinations until you're satisfied with what you see, although the fonts are restricted to the AFM types that come with "enscript" (40 options, more can be added.) I find them to be more than adequate for my purposes.

See attached preview.bash.txt

Ben Okopnik


If you can scare your OS tell someone who can fix it

Sat, 20 Dec 2003 09:54:00 -0500
Ben Okopnik (the LG Answer Gang)

Here is a non emergency head scratcher for you.

I was wondering if anyone has any experience with the Sandisk 256mb USB flash drive and Linux. I got the drive to work once, and ever since it causes a kernel panic. This is not limited by distributions or hardware, as I have had it work once on a gateway laptop, then ever after it would crash any linux machine I plugged it into.

That's pretty impressive, in a bad way. :) As you know, it's usually pretty hard to crash Linux. On the other hand, USB is a special case - for my money, all of its related problems come from the fact that it brings user-space uncomfortably close to what was always a root-priv operation (hardware usage, control over ports, etc.) One of the major reasons for that separation has always been the security truism of "physical access equals root access" - and with USB, all our noses are being rubbed in that lesson. However, everybody seems to desperately want the stuff, so...

(USB is a nifty technical hack, and serial is way outdated - but giving the average user the ability to effectively fiddle with the guts of the machine is Not A Good Idea, IMO. Ditto PCMCIA - and note that there were a few years when it had pretty much the same problems that USB is going through now. Surprise, surprise...)

Not that I don't think it's possible to get it right, mind you; it's just going to take a bit of finer slicing and dicing than (in my opinion) we've managed so far... USB under Linux is still highly fragile, although it can mostly be made to work. Note that I'm talking about the stuff out on the bleeding edge, things that most people don't use: the more common run of things (printers, mice, keyboards, etc.) is pretty stable at this point.

However, there are people out there trying to resolve this fragility, and achieving measurable gains. The important part here is that they need your help - that is, the help of anyone who runs into a problem with USB. They particularly (I'm projecting, but with a reasonable degree of certainty) love to hear from folks like you, who have found what I call a "reliable problem" - this is the core of what makes Linux work, and why it is generally as bug-free as it has a reputation for. You have a problem, notify the maintainers about it, they fix the problem, you give them feedback - and that problem is gone. Repeat until the code is washed sparkling-clean, and that chunk of Linux is bullet-proof.

SO, to wrap up this long-winded expository, please report this problem to the appropriate maintainer. You can save a bit of time, and ease their work tremendously, by running "ksymoops" with the copy of "/var/log/kern.log" that contains the "Oops" from the crash and the current copy of "/var/log/ksymoops/[whatever].ksyms", and sending them the results - or at least including those two files in the problem report.

As I said, this is a general question, I recommend not using Sandisk to my Linux using companions.

I think it would be better all around if you were to help the maintainers resolve the problem instead. :)


This page edited and maintained by the Editors of Linux Gazette
HTML script maintained by Heather Stern of Starshine Technical Services, http://www.starshine.org/

 

Copyright © 2004, . Released under the Open Publication license unless otherwise noted in the body of the article. Linux Gazette is not produced, sponsored, or endorsed by its prior host, SSC, Inc.

Published in Issue 98 of Linux Gazette, January 2004

<-- prev | next -->
Tux