___________________________________________________________________ issue 8 http://console-newsletter.hypermart.net __ __ _ _ __ __ )) __ console: tips,tricks & news about linux ((_ ((_)((\( _))((_)(( (('_ _______________________________________ [4/2000] "a good read.." + headlines Caldera Systems, Inc. set to file for its own IPO Caldera, makers of OpenLinux are joining the ranks of RedHat and others in the rush to take their offering public, we wish them all the best but cant help but wonder if the Linux "IPO craze" hasn't already reached the point of saturation. Witness VA-Research and Corel... http://www.calderasystems.com/company/press/000110ipo.html -- + hmm.. USB v2.0 specs. cost $2500 The popular Universal Serial Bus standard (an interface to easily connect printers, scanners, etc) is sadly tuning out to be a chapter out of Orwell's, "Animal Farm" which in essence means, we are equal but only those that pay for the specifications can be board members. http://www.usb.org/developers/index.html -- + humorix Back in the early 1990s, Bill Gates promised that Microsoft would finally produce an enterprise-level operating system that worked perfectly. Ten years and 63,000 bugs later, that dream is still five Service Packs away. Nevertheless, Redmond's latest creation, Windows 2000, is now officially available. Public reaction has been mixed. Below is a roundup of events and responses surrounding the Win2K launch that our Vast Spy Network(tm) has collected. http://i-want-a-website.com/about-linux/feb00.shtml#Redmond-Roundup -- + distro watch Linux In A Pillbox (LIAP) - a set of specialized, easily-configurable Linux floppies: http://www.liap.eu.org/ Serial Terminal Linux - custom init script that runs minicom, turning an otherwise unusable computer into a dumb terminal: http://members.wri.com/johnnyb/seriallinux/ -- + new apps moon-buggy 0.4.1 - a simple character graphics game: http://www.hangout.de/moon-buggy/index.html micq 0.4.4 - Matt's ICQ Clone for the console: http://phantom.iquest.net/micq/ sawmill 0.25.2 - mostly GNOME-compliant extensible window manager: http://sawmill.sourceforge.net/ -- + article procmail (email filtering made easy) - digs A quick note about this document: This article has been laying around on my hardrive in various drafts for years, as a newbie I began researching email filtering a few years back, large parts of this article came from -many- varied places, usenet; the procmail faq; and any number of websites. If you see something thats yours let me know, credit where credit is due. Also will this work with Netscape? Versions above 4.0 provide a filtering mechanism builtin, read the help included with Netscape. Finally before you start this project you -MUST- have a properly working mail reader. Filtering email can seem to be a pretty tough dragon to do battle with under Linux but when broken down to individual steps is really very easy & as a plus (you'll love that minty fresh feeling :)) you get from organization. Just what is procmail? From the man page: an autonomous mail processor or process mail, what this means for you is the ability to push your email through a set of filters and -this is the nifty part- perform actions based on matching criteria or non matching criteria for that matter. Once setup its all automatic. Basicly procmail compares each piece of incoming mail against each "recipe" then acts accordingly. Here are some basic examples: All recipes start with this header: :0 Then possibly a flag: c = copy b = body h = header note: see man procmailrc for all the flags. And if needed a closing that creates a lock file: : This recipe makes a backup of incoming mail. :0 c: backup Another example, this sends all mail from "some_twit" to /dev/null. :0: * ^From.*some_twit@anyplace.org /dev/null Yet another for your email lists, this sends all email from the newsletter "console" to a mail file called console. :0: * ^(To|From|Reply-To|Cc|Sender).*console@topica.com console One can even forward mail based on sender and/or subject: note, the "c" saves a copy. :0 c: * ^From.*jimbo@donut.com * ^Subject:.*reports ! me@my_vaction_address.net Even a "selective biff" :0 c: * ^From.*your_secret_lover@hotmail.com | xmessage "you have mail from honey bun." Lets jump right in & get down to business.(note I assume your at the command line & I'll use pico as an editor your free of course to use another editor.) 1.see if you have procmail installed on your system at the prompt type: which procmail if you don't you can pick it up from http://www.procmail.org 2.like most u*ix programs procmail depends on a "dot" or rc file in this case its called .procmailrc and is located in your home directory. cd pico .procmailrc # lines that begin with # are comments and are ignored # -always- define the next three: PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin SHELL=/bin/sh TMP=/tmp #Set on when debugging VERBOSE=on #VERBOSE=off # Directory for storing procmail log and rc files PMDIR=$HOME # Name of procmail log file LOGFILE=$PMDIR/procmail.log # Our first filter # lets play it safe & keep a backup of all incoming mail. # what this very basic recipe does is copy all mail to # ~/mail/backup :0 c: backup # Next lets try a real filter. # this puts all mail with a subject of "test" in a mail file # called: # ~/mail/testing also note that's [zero] not o. :0: * ^Subject:.*test testing 3.Next we -MUST- create a ~/.forward file so your MDA [mail delivery agent] will pass incoming mail to procmail. cd pico -w .forward "|IFS=' ' && exec /usr/local/bin/procmail -f- || exit 75 #user" BIG FAT NOTE: * Make sure the the info in your ~/.forward file is -ALL ON ONE LINE- * Yes all the quotes are needed. * The two vertical bars are pipes. * Replace /usr/local/bin with the correct path for procmail. * Replace `user' with your userid. If your login is joe then use joe. * Do -NOT- use ~ or environment variables, like $HOME, in your .forward. 4.Make your .forward world readable (so other programs can read it.) cd chmod 644 .forward chmod a+x . 5.Send your self a test message with "test" as the subject line. 6.Crank up your mailer & check if you got the message. note: you'll have to tell your mailer if you directed procmail to send the test message to a non-standard file/folder example: Pine uses mail, Elm uses Mail, while Mutt might look something like this: #.muttrc # when invoked via "mutt -y" mailboxes ~/mail/testing /var/spool/mail/$USER Once you have every thing working you can create a ~/.procmailrc better suited to your needs. I've included a copy mine below to hack away on as a starting point. Further reading: man procmailrc; man procmailex; man procmail; man formail # begin digs ~/.procmailrc # -always- define the next three: PATH=/bin:/sbin:/usr/bin:/usr/sbin SHELL=/bin/sh TMP=/tmp #Set on when debugging VERBOSE=on #VERBOSE=off # Directory for storing procmail log and rc files PMDIR=$HOME # Name of log file # the log file automagiclly LOGFILE=$PMDIR/procmail.log #LOGFILE=/dev/null # The order of this file is -very- important! # the spam entry at the bottom of this file is # there because this file takes each argument in the order given. # imagine a trickle down effect # if any line starts with a # symbol then its not read by procmail # also don't use the ~ symbol in any path statement as procmail # cant understand it # Archiving mail: ------------------------------------------------- # This recipe is real handy it allows you to save a compressed file # of mail while [appending] new mail to the same gz file. # note: a copy will still be sent uncompressed to proper mailbox. #:0 bc: #* ^(To|From|Reply-To|Cc|Sender).*your_favorite_email_list #| gzip >>archived.email.gz # unsubscribe: ---------------------------------------------------- # Just a pet peeve of mine I hate seeing unsubscribe messages so # lets send'em to the +spam folder or /dev/null :) :0: * ^Subject:.*unsubscribe /home/digs/mailbox/spam # - Email lists are next - # Basic Linux Training: ------------------------------------------- :0: * ^(To|From|Reply-To|Cc|Sender).*blt@onelist.com /home/digs/mailbox/blt # wmx mailing list: ----------------------------------------------- :0: * ^(To|From|Reply-To|Cc|Sender).*owner-wmx@42.org /home/digs/mailbox/wmx # my brother: ----------------------------------------------------- # living proof that some people have a fear of reading help files. :0 c * ^From.my_bro@newbies_r_us.net | xmessage "sup bro, how do I..." # Mailbot auto-responder thingie: --------------------------------- # This recipe will email the sender a file if the subject # line matches. Example,include something like this in your # ~/.signature file To receive my latest banana nut bread recipe # please send an email with "banana-nut" in the subject line # to: me@my_address.foo then change * ^Subject:.*WHAT_EVER to * # ^Subject:.*banana-nut make sure /somedir/somefile points to # the correct path and file #:0 #* !^From *YOUR_EMAIL_ADDRESS_GOES_HERE #* !^Subject:.*Re: #* !^FROM_DAEMON #* ^Subject:.*WHAT_EVER [note: one word sure makes it easy.] #| (formail -r ; cat /somedir/somefile) | $SENDMAIL -oi -t # - Spam filtering start here - # Some junk mail I get from xoom.com: ----------------------------- :0: * ^(From|Cc|To).*XOOM.com /home/digs/mailbox/spam # More spam: ------------------------------------------------------ :0: * ^Subject:.*free /home/digs/mailbox/spam # Ok here's a nifty recipe: --------------------------------------- # If any mail made it this far & -dosent- have your_email_address # in the To Cc From or Sender fields we send it to the +spam folder # or send it to /dev/null [BIG FAT NOTE]: # /dev/null will erase the offending email. # note: the ! symbol negates the argument ie: # To me = True [will get sent to me] # !To me = False [-wont- get sent to me] :0: * !^(To|Cc|From|Sender).*mjs@nts-online.net /home/digs/mailbox/spam # This is for testing your recipes: ------------------------------- #:0: #* ^Subject:.*test #/home/digs/mailbox/testing # Suspicious email: ----------------------------------------------- # Empty Message-IDs usually indicate a broken mail server # which are very likely used to send spam. :0: * ^Message-ID.*<> /home/digs/mailbox/spam # If any mail left slipped thru the filters they will go into # /var/spool/mail/$USER ie. your default mailbox # end -- + quote of the month "A wounded deer leaps the highest." -Emily Dickinson -- + grok CTRL-T in bash will transpose two characters; great for typos. Typing CTRL-l at a bash prompt, will clear the screen, and put the current line at the top of the screen. In BitchX, using CTRL-V will invert your text. -- + jargon :SMOP: /S-M-O-P/ n. [Simple (or Small) Matter of Programming] 1.A piece of code, not yet written, whose anticipated length is significantly greater than its complexity. Used to refer to a program that could obviously be written, but is not worth the trouble. Also used ironically to imply that a difficult problem can be easily solved because a program can be written to do it; the irony is that it is very clear that writing such a program will be a great deal of work. "It's easy to enhance a FORTRAN compiler to compile COBOL as well; it's just an SMOP." 2. Often used ironically by the intended victim when a suggestion for a program is made which seems easy to the suggester, but is obviously (to the victim) a lot of work. -- + hobbes' internet timeline 1971 Ray Tomlinson of BBN invents email program to send messages across a distributed network. The original program was derived from two others: an intra-machine email program (SENDMSG) and an experimental file transfer program (CPYNET) 1972 First computer-to-computer chat takes place during ICCC as psychotic PARRY (at Stanford) discusses its problems with the Doctor (at BBN) 1973 Bob Metcalfe's Harvard PhD Thesis outlines idea for Ethernet. The concept was tested on Xerox PARC's Alto computers, and the first Ethernet network called the Alto Aloha System -- + article Poor Man's Net Mini How-TO Ewald Arnold, ewald@ewald-arnold.de v1.1, 17 Oct 1999 How to set up a little net under Linux using RS232 to connect a laptop to a desktop computer 1. Why this document Recently, I bought a used laptop, an IBM Thinkpad 750. I was lucky to get Linux installed on it. It it has no cdrom and the floppy is useless under Linux because of some incompatibilities in the hardware. So I tried to connect it to my desktop computer which has all these useful things. You wonder how I installed my Linux distribution on cdrom under these circumstances ? First I installed (using my desktop) a core system on an ex-ternal zip drive with a kernel including zip drive support. Then I launched this kernel under DOS on the laptop and copied everything to the harddisk. After setting up lilo.conf and running lilo the system booted without problems :-) Additional software packages can now be installed from the cdrom on the desktop using the little network described below. In the meantime I have a complete system with X, Netscape, KDE and so on. This document is the summary of my experiences and is distributed in the hope that is is useful to others facing the same problem. Everything is based on my own system, running SuSE 6.0. Some things will differ to other distributions, e.g. printing. If the commands don't work properly on your system, please let me know, especially if you already have a fix for an update. It is assumed that you already have installed pppd, BSD print- ing, rpc and everything else needed on the laptop. 2. Hardware To connect the two computers you need some sort of cable, called a nullmodem. The simple version uses software handshaking to control the data flow. The "deluxe" version does this using the modem control signals (RTS/CTS). If possible, use hardware handshaking. The risk to lose data packets will decrease and the data throughput will rise. It is also very useful to have a serial chip with FIFO support. A 16550 for example can store up to 14 bytes in it's fifo chain until it signals an interrupt to gather the data. 2.1. The simple nullmodem cable DTE 1 DTE 2 9pol 25pol (female) 25pol 9pol (female) 5 7 ]--GND--------------------GND------[ 7 5 2 3 ]--RxD--------. ,---------RxD------[ 3 2 X 3 2 ]--TxD--------' `---------TxD------[ 2 3 2.2. The full-featured nullmodem cable DTE 1 DTE 2 9pol 25pol (female) 25pol 9pol (female) 5 7 ]---GND--------------------GND------[ 7 5 2 3 ]---RxD--------. ,---------RxD------[ 3 2 X 3 2 ]---TxD--------' `---------TxD------[ 2 3 7 4 ]---RTS--------. ,---------RTS------[ 4 7 X 8 5 ]---CTS--------' `---------CTS------[ 5 8 4 20 ]---DTR--------. ,---------DTR------[ 20 4 X 6 6 ]---DSR--o-----' `------o--DSR------[ 6 6 | | 1 8 ]---DCD--' `--DCD------[ 8 1 3. Software To connect the two computers you have to set up some files describing the properties of your computers. Some of them may be the same on both, some are different. 3.1. Launch the ppp deamon 3.1.1. /etc/hosts (laptop and desktop) The TCP/IP protocoll uses numbers to address computers in a network. It is possible to assign names to those numbers by adding these to a special file. Be careful with ip numbers: only use numbers beginning with 192.168.x.x which are reserved for private networks. ------- start of file ------- # # hosts This file describes a number of hostname-to-address # mappings for the TCP/IP subsystem. It is mostly used at boot # time, when no name servers are running. On small systems, # this file can be used instead of a "named" name server. Just # add the names, addresses # and any aliases to this file... 127.0.0.1 localhost 192.168.0.1 desk.home desk 192.168.0.2 lap.home lap -------- end of file -------- 3.1.2. /usr/local/bin/interlink (laptop and desktop) The following script will start and stop the ppp protocoll on ttyS0. Adopt it to your requirements: BAUD contains the baudrate to use. On computers with a serial chip with a fifo you can have full speed at 115200. Older systems like might not be able to really run faster than 38400 average, especially with hard disk writing/reading at the same time or a too slow cpu. DEV represents the serial connector you want to use. COM1 on a PC equals ttyS0, ttyS1 means COM2. Also possible is the symbolic name modem. HANDSH defines the type of handshaking. Use xonxoff for software flow control with the simple cable. Replace with crtscts for hardware flow control if you have the according cable. LOCAL / REMOTE names of the pair of computers to be connected. ------- start of file ------- # script to launch the pppd on the rs232 cable BAUD=57600 DEV=ttyS0 HANDSH=xonxoff LOCAL=lap # customize those two lines ! REMOTE=desk #============================= case "$1" in start) echo "starting interlink ($BAUD baud)" /usr/sbin/pppd -detach $HANDSH lock $LOCAL:$REMOTE \ /dev/$DEV $BAUD & ;; stop) echo "shutting down interlink" test -f /var/lock/LCK..$DEV && kill `cat /var/lock/LCK..$DEV` ;; *) echo "Usage: $0 {start|stop}" exit 1 esac exit 0 -------- end of file -------- 3.2. Using the desktop's printer This section assumes a BSD-like printing system. 3.2.1. /etc/printcap (laptop) The entry in printcap is very simple, because the files are just transfered to the desktop. It is assumed of course that the printer on the desktop is correctly working. ------- start of file ------- #/ # Copyright (c) 1983 Regents of the University of California. # All rights reserved. # Redistribution and use in source and binary forms are permitted # provided that this notice is preserved and that due credit is # given to the University of California at Berkeley. The name of # the University may not be used to endorse or promote products # derived from this software without specific prior written # permission. This software is provided ``as is'' without express # or implied warranty. # @(#)etc.printcap 5.2 (Berkeley) 5/5/88 # typical remote printer entry lp:rm=desk.home:sd=/var/spool/lpd:lf=/tmp:mx#0: lp1:rm=desk.home:sd=/var/spool/lpd/lp1:mx#0: -------- end of file -------- 3.2.2. /etc/hosts.lpd (desktop) Only hosts listed in hosts.lpd are allowed remote printing. ------- start of file ------- # # hosts.lpd # This file describes the names of the hosts which are # to be considered "equivalent", i.e. which are to be # trusted enough for allowing rsh(1) commands. # # hostname desk.home lap.home -------- end of file -------- 3.3. Mounting the desktop's filesystems 3.3.1. /etc/fstab (laptop) To mount filesystems from the desktop with user privileges, you have to include them to fstab with the user option. / Access to all mounted partitions on the desktop. /cdrom To install additional programs from my distribution cd. /a The floppy on my thinkpad does not work under linux, so the desktop is the only possibility. /z Here I mount my external zip drive. I also could connect it directly to the laptop, but for that I have to crawl behind the computer table. ------- start of file ------- desk:/ /desk nfs defaults,noauto,user 0 0 desk:/cdrom /cdrom.d nfs ro,noauto,user 0 0 desk:/a /a.d nfs defaults,noauto,user 0 0 desk:/z /z.d nfs defaults,noauto,user 0 0 desk:/usr/data /usr/data.d nfs defaults,noauto,user 0 0 -------- end of file -------- 3.3.2. /etc/exports (desktop) exports lists all hosts that are allowed to mount local filesystems and their according permissions. I added no_root_squash to have root privileges on the laptop while I work with desktop files. ------- start of file ------- # See exports(5) for a description. # This file contains a list of all directories exported to other # computers. It is used by rpc.nfsd and rpc.mountd. /cdrom lap(ro,no_root_squash) /usr/data lap(rw,no_root_squash) /mnt/hdb7 lap(rw,no_root_squash) / lap(rw,no_root_squash) /a lap(rw,no_root_squash) /z lap(rw,no_root_squash) /zv lap(rw,no_root_squash) -------- end of file -------- 3.4. Offline browsing with wwwoffle WWWOFFLE is an internet browser caching program. I gave it 100MB of disk space, what allows me to browse offline all internet files I visited the last months. Your browser must then be configured to use desk.home as proxy (on port 8080 if you did not change). 3.4.1. /usr/local/bin/internet-on (desktop) This is my short script to tell wwwoffle we're online now. Not really necessary, but useful to understand the following file ip-up. ------- start of file ------- wwwoffle -online wwwoffle -fetch -------- end of file -------- 3.4.2. /etc/ppp/ip-up (desktop) Script automatically launched by pppd after connecting. If talking to the laptop, nothing happens. If connected to my provider via modem it puts wwwoffle online. ------- start of file ------- #!/bin/sh if $5 != "192.1.2.32"; then echo 'Welcome to the internet' internet-on else echo 'connected to laptop' fi -------- end of file -------- 3.4.3. wwwoffle/wwwoffle.conf (desktop) Add the following line to wwwoffle.conf in the AllowedConnect section to give the laptop access to the cache: ------- start of snippet ------- lap.home -------- end of snippet -------- 4. Experiences The following picture is a snapshot while installing about 100M of programs on the laptop which took more than three hours. I I recognized no problems. /proc/net/dev reported about 2% of lost ppp-packets and in /var/log/messages I also found some lines about a "non responding server". This is due to the weak serial chip on the laptop and no big problem. It only means a bit more time for transfers. 5. Author My Name is Ewald Arnold and I live in south germany. My hobbies are programming, wood working and reading. You can see some examples of my work on my homepage at http://www.ewald-arnold.de/. My english is not the very best but I hope everything was understandable enough. If not, let me know about it. The most recent version of this document is located on my home- page at http://www.w-4.de/~earnold/pmn/Poor-Mans-Net.html 6. Thanks The following sites were helpful to create this mini-howto: FAQ Kabel, a german site, which describes a lot of cable faqs. Leased line mini howto, http://www.sput.signature.nl/software/leased-line.html The Linux Documentation Project Homepage Most important, a response to a question in news:comp.os.networking how to set up a pppd connection over RS232. 7. Open questions I am still looking for a program to synchronize two files/di- rectories to keep both laptop and desktop up to date. If someone knows such a (free or GPL'd !) program, tell me where to find it. -- + funnies _______ (_)___oo) Ned the log ----------- . Particle man ----------------- _______ | (_)___oo) vampire Ned | % particle man see-saw ------''---------------------------------------------------------- -- + wrap up Coming next issue: rsh (remote-shell) - run commands remotely from another box on your network. Passing arguments to your scripts - (foo -arg) Hello everyone, hope this issue finds you all doing well. As several of you that have have been with console awhile may have noticed topica now hosts the mailing of console, this change will (for the most part) be transparent. And let me welcome you newer members - console works on the premise of user submitted content, if you have an idea or experience you'd like to share by all means jump right in and send in your article (see instructions below) I'm sure newbies & guru's alike will agree, we can always learn something from one another ;) later on, digs -- + subscriptions & submittals To subscribe send a blank email to: console-subscribe@topica.com To unsubscribe send a blank email to: console-unsubscribe@topica.com To submit an article: http://console-newsletter.hypermart.net/ Past issues can be found at: http://console-newsletter.hypermart.net/old/ -- + about This issue of console was brought to you by: digs - chief writer & layout Ewald Arnold - contributor Hobbes' Internet Timeline (c)1993-9 by Robert H Zakon. http://www.isoc.org/zakon/Internet/History/HIT.html Console (c)99-00 Michael S Sanders, All Rights Reserved. -- eof