Erco's RedHat Magics

First let me say this: screw MicroSoft Windows. There, I said it. Now you know where I'm coming from.

If you are a business person interested in getting linux on your desktop, and getting work done, read this article on how a 'suit' has switched from Windows to Linux, what tools he uses to do word processing, HTML editing, presentations, accounting and Quicken replacements, etc.

Usually there are some common things people want from their workstation. Once you've installed RedHat 5.2, here's some magic stuff some people will want to know how to do to make practical use of RedHat 5.2 as their primary workstation.

This page is in progress. Watch this space for changes. I'll try to add new things as I encounter them.

If you have some magic RedHat tweaks that make you feel all warm and fuzzy? Let me know, and if it's neat, I'll add it to the list here..


Console Image Viewer (Look at images without Xwindows!)


Setting Up A Wacom Tablet


Setting Window Manager Background Image

One way is to load your image in xv(1), resave it as an xbm image, then you can execute from the command line:
       xsetroot -bitmap foo.xbm
   
Or, you can use xv(1) to make any image you display in xv(1) to become the window manager's background image:
	1) Use 'xv' to load your image
	2) Once it loads, right click on the image. A dialog pops up.
	3) Left click on the 'Root' button, and choose 'tile', or
	   'integer mirror', etc.
   


Cool Screensavers


A simple clock

I like a simple clock on my screen. I use the following alias in my .cshrc to invoke it:
    alias gregclock "xclock -digital -font '-*-helvetica-bold-r-normal--34-*-*-*-p-182-iso8859-1' -bg black -fg white -bd red -geometry -0-0 & "
This works on SGI and Linux equally well. The clock looks like this:


SGI Function Keys

I use SGIs a lot, and like to push/pop windows with the SGI style function keys, eg. ALT-F1 to pop a window, ALT-F3 to push, etc. I commented out the delete/destroy keys, cause I think they're scary.

Added the following to /etc/X11/AnotherLevel/fvwm2rc.keys.m4:

    # Keyboard accelerators
    # These are "borrowed" from the .4Dwmrc file on an SGI I use,
    # except for AltF2 and AltF6 which I added for completeness.
    # I think the other are standard Motif.  --tabaer@magnus
    Key F1          WFST    M       Raise
    #Key F2          WFST    M       Delete
    Key F3          WFST    M       Lower
    #Key F4          WFST    M       Destroy
    Key F5          WFST    M       Raise
    Key F6          A       M       WindowList
    Key F7          WFST    M       Move
    Key F8          WFST    M       Resize
    Key F9          WFST    M       Iconify
    Key F10         WFST    M       Maximize

Xdiff utility for Linux

I write a lot of text files, and because I often need to maintain several versions, one of my favorite tools on SGIs is xdiff(1) to visually compare two text files, to show the differences between them. (Under Windows, there's a similar tool known as windiff.)

In it's simplest form (below), Xdiff lets you compare two ascii files line by line, allowing you to choose which lines you want from each, to build and save a third merged file.

Actually, I'm told you can compare several (up to five) files at a time.

You can download xdiff from http://reality.sgiweb.org/rudy/xdiff/. (old link was here)

Here's an example screen shot to pique your interest.. this is version 3.3 which was available at the time this document was written (06/28/99):

Olympus D450Z Digital Camera

I like to take pictures, and love this little Olympus digital camera. It's supported under linux by a simple serial port oriented program called 'camediaplay' which works great; just plug the camera into a serial port and type 'camediaplay -g -a ttyS0' (for example) to download all the pictures. Here's where I downloaded the program:

It can be found as precompiled RPM's elsewhere, but this is the guy who wrote it. Here's docs showing the data format of the camera.
To download all the images from the camera, assuming it's plugged into serial port #1 (ttyS0):

That's it. After it's done, there's a whole bunch of jpeg's sitting in the current directory, all automatically named after the exposure number of each picture. You can see some example images taken from this camera in my LA River photo gallery webpages.

RPM Incantations

Things I find important to be able to do with RPM packages are:

Here are the incantations for the above..

How to extract a single file from an RPM


# rpm -qlp kdetoys.rpm
/usr/bin/kworldclock					# <-- the one I want
/usr/share/applications/kde-kworldclock.desktop
/usr/share/apps/kworldclock
/usr/share/apps/kworldclock/maps
/usr/share/apps/kworldclock/maps/depths
[..etc..]

# rpm2cpio kdetoys.rpm | cpio -idm /usr/bin/kworldclock
6144 blocks						# <-- it worked

# _



RPM Desciption of Package


# pwd
/mnt/cdrom/RedHat/RPMS

# rpm -qpi crontabs-1.7-7.noarch.rpm 
Name        : crontabs                     Relocations: (not relocateable)
Version     : 1.7                               Vendor: Red Hat Software
Release     : 7                             Build Date: Fri 27 Aug 1999 07:04:42 AM PDT
Install date: (not installed)               Build Host: porky.devel.redhat.com
Group       : System Environment/Base       Source RPM: crontabs-1.7-7.src.rpm
Size        : 4930                             License: public domain
Packager    : Red Hat Software 
Summary     : Root crontab files used to schedule the execution of programs.
Description :
The crontabs package contains root crontab files.  Crontab is the
program used to install, uninstall or list the tables used to drive the
cron daemon.  The cron daemon checks the crontab files to see when
particular commands are scheduled to be executed.  If commands are
scheduled, it executes them.

Crontabs handles a basic system function, so it should be installed on
your system.

# _



RPM One Line Description of all .rpm Files


# pwd
/mnt/cdrom/RedHat/RPMS

# ls *.rpm | awk '{f=$1; "rpm -qpi "f"|grep ^Sum"|getline out;gsub("^[^:]*:","",out);printf("%25.25s:%s\n",$1,out);}'

AfterStep-1.7.142-1.i386.: An X window manager which emulates the look and feel of NEXTSTEP(R).
AfterStep-APPS-990812-1.i: Various applets for use with AfterStep and compatible window managers.
AnotherLevel-1.0-1.noarch: A customized configuration of the fvwm2 window manager.
ElectricFence-2.1-1.i386.: A debugger which detects memory allocation violations.
   GXedit-1.23-3.i386.rpm: A multi-function text editor which uses GTK+.
ImageMagick-4.2.9-1.i386.: An X application for displaying and manipulating images.
.
.
# _



RPM Viewing List of Files In Package

If package not yet installed, query the rpm package file

# pwd
/mnt/cdrom/RedHat/RPMS

# rpm -qpl crontabs-1.7-7.noarch.rpm           
/etc/cron.daily
/etc/cron.hourly
/etc/cron.monthly
/etc/cron.weekly
/etc/crontab
/usr/bin/run-parts

# _

If package already installed, or rpm not available

# rpm -ql crontabs-1.7-7                   
/etc/cron.daily
/etc/cron.hourly
/etc/cron.monthly
/etc/cron.weekly
/etc/crontab
/usr/bin/run-parts

# _



RPM Reverse Lookup: What Package Owns These Files?


# rpm -qf /bin/ping
netkit-base-0.10-29
                            
# _



RPM Installing a Package


# pwd
/mnt/cdrom/RedHat/RPMS

# rpm -ivh crontabs-1.7-7.noarch.rpm          
[.. ascii progress bar ..]

# _



RPM Extracting Specific Files Or Directories


# pwd
/

# rpm2cpio /mnt/cdrom/RedHat/RPMS/apache-1.3.12-25.i386.rpm | cpio -d --extract ./usr/lib/apache/'*'          

# _



Internet Gateway DNS Configuration

   This is an excerpt from my administration logs, describing
   how I setup DNS on my internet gateway machine to cache remote
   loookups, while acting as a server for hostnames on my own network.

--- 06/24/00,11:54:20 - erco: nameserver config on rotwang (FINALLY!)

    Create ficticious domain 'erco.x', and have nameserver handle it.
    I have 4 machines on this network. The idea is to have DNS resolve
    them all, including the aliases (ie. 'rot') as CNAMES. My old hosts
    file:

        192.168.10.1    nt
        192.168.10.2    howland.erco.x howland how
        192.168.10.3    rotwang.erco.x rotwang rot
        192.168.10.4    vaio.erco.x    vaio    va

    Note that 192.168.10.* is my network. So we'll want to also create
    a reverse lookup that's authoritative for that subnet. Here's the
    network map:
			      erco.x 
		      DNS domain (192.168.10.*)
           ___________________________________________
          |              |              |             |
     192.168.10.1   192.168.10.2  192.168.10.3  192.168.10.4
         "nt"         "howland"    "rotwang"       "vaio"
                                        |
                                        |
                                      modem
                                        |
                                        |
                                       ISP

    The DNS server is running on "rotwang", and answers authoritatively
    for the four machine names, and acts as a caching name server for
    everything else (ie. all internet addresses).

    All four machines use "rotwang" as their DNS server.

    "erco.x" is a fictious domain, which is only seen locally by my
    private network (all queries from my network for that domain are 
    intercepted by my name server)

    So basically, the following is a caching nameserver config, 
    with a single domain, "erco.x", for which it answers authoritatively,
    including reverse lookups.

    The root.cache was created with:

          dig @f.root-servers.net . ns > /var/named/root.cache

    ..and should be executed regularly via a monthly crontab.

    You can use these as templates; just change the red and blue text 
    to suit the specifics of your network;

         * red is your ISP related info
         * blue is your local network info


How To Add Hosts To DNS

How To Configure Clients To Use Your DNS Server

    Windows 98 Client DNS Config
    ----------------------------

        1) Right click on "Network Neighborhood -> Properties"
        2) Go into TCP/IP
        3) Under 'DNS Server addresses':

                a) Delete any entries already there
                b) Hit ADD, and enter the IP of your DNS server:

        4) Enable 'Append these DNS suffixes (in order)', then:

                a) Delete existing entries if any
                b) Hit ADD, and enter your domain name, eg:

                        erco.x

    Windows 2000 Client DNS Config
    ------------------------------

        1) Right click on "My Network Places" -> Properties
        2) Right click on "Local Area Connection" -> Properties
        3) Double click on "Internet Protocol (TCP/IP)"
        4) Click on "ADVANCED"
        5) Click on "DNS" tab
        6) Under 'DNS Server addresses':

                a) Delete any entries already there
                b) Hit ADD, and enter the IP of your DNS server.

        7) Enable 'Append these DNS suffixes (in order)', then:

                a) Delete existing entries if any
                b) Hit ADD, and enter your domain name, eg:

                        erco.x

        8) Disable "Register this connection's addresses in DNS"

        9) Click on the "WINS" tab
        10) Disable "Enable LMHOSTS lookup"
        11) Enable only "Enable NetBIOS over TCP"
        12) Hit OK, and ignore any error about 'empty WINS' whatever.
        13) That's it. Be sure to test it.
    
    Mac OSX Client DNS Config
    -------------------------

	1) Go into "System Preferences | Network | Tcp/IP", and set:

                DNS Servers: 192.168.0.14             <-- Your DNS Server's IP
             Search Domains: erco.x                   <-- Your domain name

        2) That's it. Be sure to test it.

    Linux/Irix Client DNS Config
    ----------------------------

	1) Edit the /etc/resolv.conf file to read, eg:

	    search erco.x                  <-- Your domain name
	    nameserver 192.168.0.14        <-- Your DNS server's IP address

	2) Edit the /etc/nsswitch.conf file, and verify the 'hosts:' entry reads:

                  hosts: files dns

	3) Make sure your /etc/hosts file only has an entry for 'localhost'
           and the machine's own hostname. (Anything else is usually special purpose.)

        4) That's it. Be sure to test it.

How To Test Your DNS

Domain Listing


# nslookup
Default Server:  rotwang.erco.x
Address:  192.168.10.3

> ls -d erco.x        # or use eg. 'dig @rotwang ixfr=0 erco.x'
[rotwang.erco.x]
$ORIGIN erco.x.
@                       6H IN SOA       rotwang erco.3dsite.com. (
                                        3               ; serial
                                        8H              ; refresh
                                        2H              ; retry
                                        1W              ; expiry
                                        6H )            ; minimum

                        1D IN NS        rotwang
                        1D IN MX        10 mail.3dsite.com.
rotwang                 1D IN HINFO     "intel" "linux"
                        1D IN A         192.168.10.3
nt                      1D IN HINFO     "intel" "winnt"
                        1D IN A         192.168.10.1
va                      1D IN CNAME     vaio
howland                 1D IN HINFO     "sgi" "irix6.2"
                        1D IN A         192.168.10.2
rot                     1D IN CNAME     rotwang
how                     1D IN CNAME     howland
localhost               1D IN A         127.0.0.1
vaio                    1D IN HINFO     "intel" "linux"
                        1D IN A         192.168.10.4
@                       6H IN SOA       rotwang erco.3dsite.com. (
                                        3               ; serial
                                        8H              ; refresh
                                        2H              ; retry
                                        1W              ; expiry
                                        6H )            ; minimum

> _

Name Lookups


# nslookup
Default Server:  rotwang.erco.x
Address:  192.168.10.3

> vaio.erco.x                   ; FQDN lookup
Server:  rotwang.erco.x
Address:  192.168.10.3

Name:    vaio.erco.x		; (See erco.x.forward A record "vaio  A  192.168.10.4")
Address:  192.168.10.4

> vaio                          ; simple hostname lookup
Server:  rotwang.erco.x
Address:  192.168.10.3

Name:    vaio.erco.x		; (See erco.x.forward A record "vaio  A  192.168.10.4")
Address:  192.168.10.4

> va                            ; hostname alias lookup
Server:  rotwang.erco.x
Address:  192.168.10.3

Name:    vaio.erco.x		; (See erco.x.forward CNAME record "va  CNAME  vaio")
Address:  192.168.10.4
Aliases:  va.erco.x

> 192.168.10.4                  ; reverse lookup (IP address)
Server:  rotwang.erco.x
Address:  192.168.10.3

Name:    vaio.erco.x            ; (See erco.x.reverse PTR record "4  PTR  vaio.erco.x.")
Address:  192.168.10.4

> _


How to fix the Backspace/Delete Problem


Configuring DNS/Sendmail


How to copy/re-record music CDs

Quickie Samba Configuration

Configuring Rsh/Rlogin (Promiscuous Config)

Subject: [SYSADMIN] Configuring rsh/rlogin for linux
From: Greg Ercolano 
Date: Sun, 25 Oct 2003 12:00:22 -0700
  
RSH + RLOGIN CONFIGURATION FOR REDHAT LINUX
-------------------------------------------
A lot of folks ask me about how the !^@# to get rsh/rlogin
working under linux so that it doesn't ask for passwords,
and programs like 'rcp' can work without errors.

Yeah, since the unix world started becoming so security conscious,
programs like rsh/rlogin have become harder to configure.

Anyway, here's how, assuming you have a firewalled network,
and want a fairly 'open' configuration so that root and users
can hop between machines without seeing password prompts,
and commands like 'rcp' and 'rdist' can work properly.

Do the following /as root/:

	1) Make sure the needed binaries are installed.
	   Normally this is done for you, but sometimes people miss this.
	   On a redhat 9.0 machine you should see:

		# rpm -qa | egrep 'rsh|inetd'
		rsh-0.17-14
		xinetd-2.3.10-6
		rsh-server-0.17-14

	   If they're not installed, get your redhat install CDs, and
	   use a command like 'rpm -ivh /mnt/cdrom/RedHat/RPMS/.rpm',
	   to install them.

	   For older linux machines (7.x and back), make sure 'inetd' instead
	   of xinetd is installed.

	2) Make sure rsh and rlogin are enabled in /etc/inetd.conf (old 7.x machines)
	   or in /etc/xinetd.d (newer redhat versions 8.x and up):

		o On (7.x and back) make sure rsh and rlogin are uncommented
	   	  from /etc/inetd.conf and the 'inetd' daemon is running. If not:

		      chkconfig inetd on ; /etc/init.d/inetd start

		  If you make any changes to inetd.conf, be sure to
	   	  'killall -1 inetd'.

	   	o On newer machines (redhat 8.x and up) make sure the /etc/xinetd.d/rsh
		  and /etc/xinetd.d/rlogin files exist, and xinetd is running. If not:

		      chkconfig xinetd on ; /etc/init.d/xinetd start

		  Make sure /etc/xinetd.d/rlogin and /etc/xinetd.d/rsh have 'disable = no'.
		  These are text files; just edit them. If you make any changes to these
		  files, be sure to 'killall -1 xinetd' so the daemon sees the changes.

	3) Open up /etc/hosts.allow, /etc/hosts.deny,
	   hosts.equiv and root's .rhosts file.

	   First backup the originals:

		cp /etc/hosts.allow /etc/hosts.allow.orig
		cp /etc/hosts.deny  /etc/hosts.deny.orig
		cp /etc/hosts.equiv /etc/hosts.equiv.orig
		(there is no stock /root/.rhosts, so no backup needed)

	   Then make these changes:

		umask 022
		echo 'ALL: ALL' > /etc/hosts.allow
		echo '' > /etc/hosts.deny
		echo + > /etc/hosts.equiv
		echo + > /root/.rhosts

	4) Tweak /etc/pam.d/rsh to allow promiscuous '+' characters
	   in the hosts.equiv and .rhosts files, and disable checks
	   for the /etc/securetty file for rsh/rlogin:

		3a) Comment out the 'pam_securetty.so' line, eg:

		    #auth       required     pam_securetty.so

		3b) Append to the pam_rhosts line the arguments
		    'hosts_equiv_rootok' and 'promiscuous':

		    auth  required  pam_rhosts_auth.so hosts_equiv_rootok promiscuous

	5) Make the same tweaks to the /etc/pam.d/rlogin file.

[..]

REFERENCES
----------
To read about what the changes to the pam files do,
run 'locate pam_rhosts pam_securetty' and view the
README files; eg:

-------------------------------------------------------

root@ontario# locate pam_securetty
/usr/share/doc/pam-0.75/txts/README.pam_rhosts
/lib/security/pam_rhosts_auth.so
/usr/share/doc/pam-0.75/txts/README.pam_securetty
/lib/security/pam_securetty.so

root@ontario# more /usr/share/doc/pam-0.75/txts/README.pam_securetty
pam_securetty:
         Allows root logins only if the user is logging in on a
         "secure" tty, as defined by the listing in /etc/securetty

         Also checks to make sure that /etc/securetty is a plain
         file and not world writable.

	[..]
-------------------------------------------------------

To read about /etc/hosts.equiv, see 'man hosts.equiv'.
To read about /etc/xinetd.d, see 'man xinetd.conf' et al.
To read about /etc/hosts.allow and deny, see 'man tcpd'
and 'man hosts.allow' et al.

For 'locate' to work correctly, 'updatedb' must have been run
recently to update the locate dababase, which is usually done
automatically by cron via /etc/cron.daily/slocate.cron, which
you can run manually if needed.

Solving Alt-Left problem with KDE and Gimp


Tweaks often needed to get thunderbird working right


Using rsync