"Linux Gazette...making Linux just a little more fun! "


More 2¢ Tips!


Send Linux Tips and Tricks to gazette@ssc.com


Contents:


Boot Information Display

Date: Fri, 1 Nov 1996 09:58:52 -0800 (PST)
From: Laurie Lynne Tucker

dmesg | more -- Forget (or couldn't look fast enough) at boot time? This command will display your boot information (a.k.a., the "kernel ring buffer"). For more info, see the man page.


A 2 Cent Console Trick

Date: Fri, 08 Nov 1996 03:42:27 -0800
From: Igor Markov imarkov@math.ucla.edu
Organization: UCLA, Department of Mathematics

Hi,

Here's my 2c console trick:
I put the following line into my ~/.xsession file:

 
nxterm -ls -geometry 80x5+45+705 -rv -sb -name "System mesages" -fn 5x7
       -T "System messages" -e tail -f /var/log/messages &
and this one into my .fvwm:
 
Style "System messages" NoTitle, Sticky, WindowListSkip
When I login, I have a small 5-line (but scrollable) window near the left bottom corner (you may need to change numbers in -geometry) where system messages appear in tiny font as soon as they are produced. This lets me see when my dial-up script succeeds, when someone logs into my computer via TCP/IP, when some system error happen etc.

The .fvwm setup strips the title bar and does other useful things, but is not necessary.

Caveat: if you leave this window for long time, a cron job which trims /var/log/messages will change the inode # for the file and tail -f is bound to freeze. In 99% this cron job wakes up 2-3am, so tail freeze may freeze only overnight. Login/logout and everything will be OK. Any other ideas?

Igor


Firewalling / Masquerading with 2.0.xx

Date: Sat, 2 Nov 1996 10:57:30 -0500 (EST)
From: Preston Brown pbrown@econ.yale.edu

Regarding the recent message about not being able to get IP masquerading working with 2.0.xx kernels:

First, I *believe* that IP forwarding may have to be enabled for firewall support, but I can't say for sure. Suffice to say that I have forwarding, firewalling, and masquerading all compiled into my kernel. I have a PPP link set up to the outside world, and my local ethernet subnet (192.168.2.x) is masquerades so it can talk to the outside world as well.

ipfwadm is used to set up the information (I call it from /etc/rc.d/rc.local at boot time):

 
# ip forwarding policies
ipfwadm -F -p deny			; default policy is to deny 
					; forwarding to  all hosts.
ipfwadm -F -a m -S 192.168.2.0/24	; add an entry for masquerading of
					; my local subnet
modprobe ip_masq_ftp			; load ftp support module
a 'ipfwadm -F -l' (i.e. list all forwarding policies) yields:
 
IP firewall forward rules, default policy: deny
type  prot source               destination          ports
acc/m all  192.168.2.0/24       anywhere             n/a
Indicating that all is fine. Your local subnet now should be set up to talk to the outside world just fine.

---
-Preston Brown, preston.brown@yale.edu


FTP and /etc/shells

Date: Fri, 1 Nov 1996 09:58:52 -0800 (PST)
From: Laurie Lynne Tucker

A user's shell must be included in the list at /etc/shells for ftp to work!!!!! (by default, you get only /bin/sh and /bin/bash!)

--
laurie


How to Truncate /var/adm/messages

Date: Fri, 1 Nov 1996 09:58:52 -0800 (PST)
From: Alex

In answer to the question:

What is the proper way to close and reopen a new /var/adm/messages file from a running system?
Step one: rename the file. Syslog will still be writing in it after renaming so you don't lose messages. Step two: create a new one. After re-initializing syslogd it will be used. Step three: Make syslog use the new file. Do not restart it, just re-initialize.
  1. mv /var/adm/messages /var/adm/messages.prev
  2. touch /var/adm/messages
  3. kill -1 pid-of-syslogd

This should work on a decent Unix(like) system, and I know Linux is one of them.


HTML, Use of BODY Attributes

Date: Thu, 14 Nov 1996 12:55:15 -0500
From: "Michael O'Keefe", michael.okeefe@lmc.ericsson.se
Organization: Ericsson Research Canada

G'day,

If you are going to use any of the attributes to the <BODY> tag, then you should supply all of the attributes, even if you supply just the default values.

The default <BODY> tag for Netscape, Mosaic and MSIE is <BODY BGCOLOR=#C0C0C0 TEXT=#000000 LINK=#0000FF VLINK=#0020F0 ALINK=#FF0000>

If you wish to slip the BACKGROUND attribute in there, by all means continue to do so, but for completeness (and good HTML designing) you should supply the other attributes as well.

The reason? You don't know what colors the user has set, and whether just setting a BACKGROUND image, or just a few of the colors will render the page viewable or not. By supplying all of the values, even at their defaults, you ensure that everything contrasts accordingly

 
-- 
Michael O'Keefe                      |Michael.OKeefe@lmc.ericsson.se_   
Lived on and Rode a Honda CBR1000F-H |okeefe@odyssee.net           / |  
"It can't rain all the time"         |Work:+1 514 345 7900 X5030  /  |  
 - The Crow -  R.I.P. Brandon        |Fax :+1 514 345 7980       /_p_|  
My views are MINE ALONE, blah blah,  |Home:+1 514 684 8674       \`O'|  
  yackety yack - don't come back     |Fax :+1 514 684 8674(PCon?)_/_\|_,


"lowerit" Shell Script

Date: Fri, 1 Nov 1996 09:58:52 -0800 (PST)
From: Phil Hughes, fyl@ssc.com

Here is a handy-dandy little shell script. It takes all the plain files (not directories) in the current directory and changes their names to lower case. Very handy when you unzip a bunch of MS-DOS files. If a name change would result in overwriting an existing file the script asks you before doing the overwrite.

 
--------------------------- cut here -----------------------------------
#!/bin/sh
# lowerit
# convert all file names in the current directory to lower case 
# only operates on plain files--does not change the name of directories
# will ask for verification before overwriting an existing file
for x in `ls`
  do
  if [ ! -f $x ]; then
    continue
    fi
  lc=`echo $x  | tr '[A-Z]' '[a-z]'`
  if [ $lc != $x ]; then
    mv -i $x $lc
  fi
  done


Removing Users

Date: 11 Nov 1996 18:54:02 GMT
From: Geoff Short, grs100@york.ac.uk

To remove users do the following:

Simple setups:

  • Delete password entry for user from /etc/passwd
  • Remove user's files using rm -r /home/user
  • Reboot (if any processes still running)
More complex setups:
  • http://kipper.york.ac.uk/rmuser.html
Geoff
----------------------------------------------------------------------------
Ever sit and watch ants? They're always busy with          grs100@york.ac.uk
something, never stop for a moment.  I just          geoff@kipper.york.ac.uk
can't identify with that kind of work ethic.  http://kipper.york.ac.uk/~geoff
----------------------------------------------------------------------------


Root and Passwords

Date: Fri, 1 Nov 1996 09:58:52 -0800 (PST)
From: Steve Mann smann@ultrix.ramapo.edu
Subject: Re: Root and passwords

If you have forgotten your root password:

  1. Use a boot disk.
  2. Login as root.
  3. Mount the partition with your Linux.
  4. Edit the second field, which is the encrypted password, of /etc/passwd to show nothing. It would look something like this:
     
    root::0:0:root,,,:/:/bin/zsh
    
    instead of something like this:
     
    wimpy:GoqTFXl3f:0:0:Steve:/root:/bin/zsh
    
You should then be able to login as root with no password at all.

Steve

 
  ==================================================================
 /  Steve M                        Insignificant message goes here  \  
|   CCIS:      529-7500 x7922                             \|||/      |
|   Home:      722-1632                                    0 *       |
|   Beeper:    1-800-502-2775 or 201-909-1575           oo0 ^ 0oo    |
|   Email: smann@ultrix.ramapo.edu                      ~~~~~~~~~    |
|   Ramapo College Apartments (Cypress Q): 934-9357
 \                  This line left blank for no reason              /
  =================================================================


Talk Daemon and Dynamic Addresses

Date: 11 Nov 1996 16:33:02 GMT
From: Adam Jenkins, ajenkins@kalgoorlie.cs.umass.edu
Organization: CMPSCI Department, UMass Amherst

Having problems sending a talk request to an IP-address other than your own?

The solution is to reset your host name to your new dynamic address. You need to figure out what dynamic address you've been assigned. Then you can use the "host" command to find the symbolic name for it, and then use the "hostname" command to reset your machine's hostname. Like this:

host 128.119.220.0a

Prints out a name. Use it in:

hostname name.domain.edu

That's it. You need to be root to run the "hostname" command with an argument. If you're using pppd to get your connection, you can put all of this into your /etc/ppp/ip-up script -- read the pppd man page for more info -- so that it will get done automatically when you log in.

The reason you need to do this is because when talk sends a talk request, it also sends along what it thinks is the return address so that the remote talk can respond. So if your local machine has a fake address, the remote talk will get that as the return address and you'll never see the response.

I also saw a patched version of talk on sunsite somewhere, where he made some hack to talk to get it to find your real address. But I like the "hostname" solution better because I've found at least one other program with the same problem, and the "hostname" solution fixes it too.


tar Tricks

Date: Tue, 12 Nov 1996 15:01:58 +0000
From: Dominic Binks dominic.binks@aethos.co.uk
Organization: AEthos Communication Systems Ltd.

A couple of things that interested me about the article on tar. I'm sure that the idea is to introduce pipes, and some of the lesser known unix utilities (tr, cut), but

 
	tar -tfvz file.tar.gz | tr -s ' ' | cut -d ' ' -f8 | less
can be written more concisely
 
	tar tfz file.tar.gz | less
Also you can use wild cards so
 
	tar tfz file.tar.gz *README*
will list all readmes in the file.

Finally two last pieces of useful Unix magic.

 
	tar cfv - dir
will tar the directory dir and send the output to standard output. One piece of magic liked by Unix gurus is
 
	tar cfv - dir | (cd dir2; tar xf -)
which copies one directory hierarchy to another location.

Another piece of tar that might be really useful is that taring up a dos file system and moving it somewhere else will preserve *everything*. This means you can move your main DOS partition around, something that is very difficult to do with DOS.

One final tip for all UNIX newbies: you got a file which unix will not allow you to delete.

 
	rm -- 'file'
will get rid of it. In general -- terminates argument processing so that everything following is passed directly to the executable.

Have fun

Dominic Binks


[ TABLE OF 
CONTENTS ] [ FRONT PAGE ]  Back  Next


This page maintained by the Editor of Linux Gazette, gazette@ssc.com
Copyright © 1996 Specialized Systems Consultants, Inc.