# More 2¢ Tips!

Send Linux Tips and Tricks to linux-questions-only@ssc.com

- Tech tips from Linux Journal's Weekly News Notes
  - Private domains
  - On-line dictionary
  - Telnet via http
  - Changing the title bar on an xterm
  - Running BIND as non-root
  - HTML Tidy
  - Moving Internet services among servers
- sendmail 2c TIP * 2
- About Converting Image Files
- While in hack mode...
- xshowrgb (xcolorsel replacement)
- re: kernel compilation error in issue 70
- Tarpit
- Monitoring log files in real time
- HSP Micromodem
- Query about Makefile
- Re: linux signwriting programs

### LJ Tech Tips

September 2001

#### Private domains

If you give an example hostname in documentation or as part of your answer in an on-line forum, use one of the safe domains listed in RFC 2606. example.com, example.net and example.org are not assigned to anyone, so you can safely use them in examples without someone's actual server getting slammed if a reader takes you literally.

#### On-line dictionary

When someone says you're "meretricious", that's a compliment, right? Not necessarily. Save yourself a trip to the library with the easy-to-use dict utility by Rik Faith, available on the dict.org web site: http://www.dict.org/links.html

The Dictionary Server Protocol is RFC2229

Or use Merriam-Webster's dictionary:
  http://www.m-w.com

#### Telnet via http

If you can only do HTTP from work and want to send resumés from your shell account, check out GNU httptunnel. It encapsulates any TCP connection in an HTTP connection, so it will work through an application-level proxy.

(PPP over ssh over httptunnel is left as an exercise for those readers who really want to give the corporate security pigs the finger.)

You can get more information from Nocrew.org:
  http://www.nocrew.org/software/httptunnel.html

or from GNU.org:
  http://www.gnu.org/directory/httptunnel.html

#### Changing the title bar on an xterm

"xterm" isn't a very helpful window bar title for an xterm. You can put extra information in the title bar, however, with escape sequences. For example, this repeats your shell prompt both in the title bar and the command line:

> export PS1="\[\033]0;$PS1\007\]$PS1"

For more xterm title bar customization, see the Bash Prompt HOWTO by Giles Orr:
  http://www.shelluser.net/~giles/bashprompt/howto/xterm-title-bar-manipulations.html

#### Running BIND as non-root

One of the main rules of security is "Don't run anything as root that you don't have to." To run BIND as a non-root user, first create a user and group "named", then add the -u (user) and -g (group) options to the init script for BIND.

On some distributions the init script is called "bind" and on others it's called "named".

For example, in Debian, change the "start-stop-daemon" line in `/etc/init.d/bind` to:

`start-stop-daemon --start --quiet --exec /usr/sbin/named -- -g named -u named`

#### HTML Tidy

Got old web pages that are so messy you just stick a couple of extra </table> tags on the end and hope for the best? Try HTML Tidy, the pretty-printer for HTML, available from the HTML Tidy web site: http://www.w3.org/People/Raggett/tidy or your favorite Linux packages site.

HTML Tidy fixes common HTML mistakes and puts everything in an easy-to-edit format. The author claims it does a good job of stripping excess markup from Microsoft Word documents saved as HTML, too.

#### Moving Internet services among servers

To keep the flexibility of moving services from one system to another without reconfiguring all the clients, it's a good idea to set up CNAME records in your DNS. Some good examples are "pop", "smtp", "news", "shell" and "webproxy"--that way you can move the outgoing mail server or the Squid server to its own host without having to reconfigure all the clients.

But with the increasing number of mobile users, don't make the mistake of, for example, setting client software to only use "smtp" and "pop" for their mail. Fully qualify the domain name, so that when they take their laptops to the leetconference.com network, they don't end up trying to send their mail through smtp.leetconference.com by mistake, and get it bounced back for attempted spamming. Configure client software for CNAMEs like smtp.internal.example.com.

### (sendmail 2c TIP) * 2

Thu, 13 Sep 2001 18:50:56 -0700
Guy Milliron (The Answer Gang)

2c TIP: Sendmail ignores everything after a plus symbol in a username field of an email address. Hence if while cruisin the Wild Wide Waste, you come across something that needs your email address, you and put in USER+comment@domain.com When you get mail/UCE/Spam to that address, you'll know who sold it, or put it on a web page and a spider ran across it. Even works on webpages when you want to put a "Mail Me" link. At least you know a spider harvested your address.

Which leads into another 2c TIP. I use `/etc/aliases` file to control my mail. Like I could alias "fubar" to my normal email account "guy". If for some reason I get a lot of spam from that email address "fubar" - I would just delete the alias "fubar" from the file, and the "account" is gone, but my normal email address is intact for my friends to use.

I do this with my clients that I host for. I inform them of the benefits of aliasing, and then offer each account they have up to 3 aliases.

Smile
--
Guy Milliron

### A 2 Cent About Converting Image Files

Sat, 8 Sep 2001 18:04:03 -0500
Chris Gianakopoulos (The Answer Gang)

Hello Answer Gang, Sometime this week, I noticed that somebody was asking about how to automating the Gimp so that it could convert image file formats from one format into another from the shell command line.

I cannot remember who it was, because I lost the email, thus, I'll post this message and hope that the person will see my posting.

The ImageMagick tools will do the trick. They have a utility called "convert" that can do the necessary conversions from the command line.

I must give credit to the author of the article. Her name is Katja Socher, and the URL is http://www.linuxfocus.org/English/July2001/article211.shtml. Her article is entitled "Do magic with images on the shell". She shows all kinds of cool things that can be done with ImageMagick.

I just stumbled on the article, and by coincidence, I was also trying to find a tool to convert images from one format into another. Of ImageMagick can do much more than convert images.

Chris Gianakopoulos

### While in hack mode...

Sat, 15 Sep 2001 15:28:55 +0000
Ben Okopnik (The Answer Gang)

Back in LG#60, one of our readers ("Roy") posted a little Tcl/Tk script to TAG - in effect, this thing pops up a little 'sticky note' with a message, and goes away when it's clicked. I saved it, and put it to use occasionally - it's a rather useful toy. A few minutes ago, however, I happened to glance at the code, and noticed that there was a "dead" section in there, code that was supposed to execute but didn't. So, having fixed it and added a usage message, here's the 'New and Improved' version of the script I called "3m" for semi-obvious reasons:

see attached misc/tips/sm.tcl.txt

Contrary to the original author's statement, "funny characters" (shell metacharacters) can indeed be used in the message; simply enclose the entire message in single quotes.

`# This displays the message and saves it with a timestamp
3m - Lunch with Liana, 1:00-2:00pm Sunday &`

`# Oh-oh - here come those funny characters!
3m 'Watch out for Larry, &Moe&, and %Curly%!!!' &`

Tcl/Tk will simply display the quoted text enclosed in curly braces. Also, note the (unquoted) '&' at the end of the line - this puts the process in the background, and allows you to continue using your xterm... perhaps to launch more 'sticky notes'.

### xshowrgb (xcolorsel replacement)

Mon, 17 Sep 2001 15:52:11 +1200 (NZST)
Ryurick M. Hristev (r.hristev from phys.canterbury.ac.nz)

Hello,

For your 2c Tips page:

> Attached is an perl script as a xcolorsel replacement (xcolorsel doesn't work on X11R6).

Require the perl-Tk package (RedHat users may find it on the Developer Module Archive disk).

see attached misc/tips/xshowrgb.perl-tk.txt

Cheers,
--
Ryurick M. Hristev

I usually use xcolors or gcolorsel, myself. With the caveats that xcolors creates a huge window and gcolorsel requires GNOME, they're enough for me to get a quick eyeball on the named color I want to use. -- Heather

### re: kernel compilation error in issue 70

Tue, 11 Sep 2001 00:12:55 -0400
Kenneth Veith (kencv from coil.com)

Hi,

I ran into similar problems. The following, from RedHat's site, fixed the problem for me.

#### 7.1 Compiling a kernel from source in Red Hat Linux 7

For various reasons, gcc is no longer able to compile the kernel from source because it uses the 2.96 version of the GNU C Compiler. However, it is still easy to compile your kernel, as version 2.91.66 of the egcs C compiler has been included with the distribution. Please note that the details involved with compiling a kernel are not covered here. For more information please read the Linux Kernel HOWTO at http://www.redhat.com/mirrors/LDP/HOWTO/Kernel-HOWTO.html. This document is assuming you have a basic grasp of what is necessary to compile a kernel and simply cannot get the @$&%@$@*% thing to compile in Red Hat Linux 7. This information only applies to pristine source, downloaded from a site such as kernel.org, as the changes necessary to compile have already been made to the source from the kernel-source-2.2.16-22.i386.rpm package.

After downloading and extracting the source in `/usr/src`, cd to/usr/src/linux and open the Makefile in your favorite editor. You will need to look for a line similar to this:

    CC      =$(CROSS_COMPILE)gcc -D__KERNEL__ -I$(HPATH)

This line specifies which C compiler to use to build the kernel. It should be changed to:

    CC      =$(CROSS_COMPILE)kgcc -D__KERNEL__ -I$(HPATH)

for Red Hat Linux 7. The kgcc compiler is egcs 2.91.66. From here you can proceed with the typical compiling steps.

The url for this is
  http://www.redhat.com/support/docs/gotchas/7.0/gotchas-7-7.html#ss7.1

Hope this helps.
Kenneth Veith

### Tarpit

Thu, 20 Sep 2001 11:03:21 -0700
Mike Orr (LG Editor)

Here's a tar pit program that sits on unused IP addresses and plays with Internet worms.

http://www.threenorth.com/LaBrea

Courtesy Slashdot. -- Mike

### Monitoring log files in real time

Thu, 20 Sep 2001 13:06:48 -0700
Mike Orr (LG Editor)

When you're debugging a program that writes error messages to a log file, run "`tail -f LOGFILENAME`" in another window. You'll see the error messages immediately when they occur.

If it's hard to distinguish the lines referring to the latest error, press Enter a few times in that window. That won't affect the file, but it will put a few blank lines on the screen. Then it will be easy to see where the next error message starts.

-- Mike

### HSP Micromodem

Mon, 10 Sep 2001 21:58:22 -0500 (COT)
John Karns (The Answer Gang)

JJ asked:

Pie ChartsHi all, I'm desperately looking for a driver for my HSP56 Micromodem, a device integrated on my Mainboard. Could you suggest some site to download it?

Try searching for "linmodem" with your favorite search engine - I usually favor google for Linux related searches. There is a site dedicated to information regarding setting up modems under Linux, and is called something like www.linmodem.org. I can't remember whether it's .org or .net, or something else.

-- John Karns

It's plural, and .org ...
  if anything calls itself an "HSP" "HSF" or "HCF" modem, this is the place to see if linux hates it or can deal with it. -- Heather
  `http://www.linmodems.org/`

### Query about Makefile

Tue, 18 Sep 2001 22:10:39 -0500
Chris Gianakopoulos (The Answer Gang)

Amol wrote:

Hello everybody ,

I am new to this Linux field . I just want to know all information about Makefile concept used for compling and configuring Linux kernel . Where can I get good resource about Makefile ?

amol

Hi Amol, I read a book entitled "Mastering Make, A Guide to Building Programs on DOS, OS/2, and Unix Systems" by Tondo, Nathanson, and Young. The ISBN is ISBN 0-13-121906-5. I suspect that the O Reilly book about make is also good.

Hope that helps,
Chris Gianakopoulos

### Re: linux signwriting programs

Tue, 4 Sep 2001 10:11:42 -0700
Mike Orr (LG Editor)

Steve Gosden wrote:

PLEASE SEND ME TO A SITE WHERE I CAN DOWNLOAD A SIGNWRITING PROGRAM THAT USES LINUX.
REGARDS STEVE

The 'banner' program prints large ASCII banners. On Debian it's `/usr/games/banner`, part of the standard 'bsdmainutils' package.

If that program isn't suitable, tell us more about what kinds of signs you're trying to make.

Do any Answer Gang members have recommendations for making signs with colors or signs with graphics?

You could try one of these:

- AAType - like banner, only uses AAlib and truetype fonts to make it look cool:
  `http://w1.520.telia.com/~u52013156/aatype.html`
- gozer - another truetype text banner thingy:
  `http://linuxbrit.co.uk/gozer/`
- figlet is especially handy, it comes with most distros:
  `http://ianchai.50megs.com/figlet.html`
- and if he means "normal" signs ... as long as your printer is up to it, there is OF COURSE my favorite, The Gimp. Pretty darn easy to tell it you want 250 point fonts. It isn't trying specially to be "Print Shop Deluxe" ... aiming more for Photoshop really ... but you can do just about anything with it.
  `http://www.gimp.org`
- If it was one of those banner/greeting card/calendar etc. programs you wanted then maybe Chilliware's IceSculptor would work for you. As far as I can tell Chilliware itself is unreachable (were they bought by someone?) but it's pretty easy to find their boxed product in various e-stores, at least right now. I can't give you any info about how easy it is to install, etc.

-- Heather

Long ago on the VAX/VMS mainframes we used to make ASCII-art signs that showed Snoopy holding a sign with your text on it. Since the printer used that tractor-fed paper, it was easy to make a wide sign. The program might have been called 'banner'.

We had them in my old PDP-11 days, certainly. -- Heather

##### This page edited and maintained by the Editors of Linux Gazette Copyright © 2001
Published in issue 71 of Linux Gazette October 2001

###### HTML script maintained by Heather Stern of Starshine Technical Services, http://www.starshine.org/