1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>More 2 Cent Tips & Tricks Issue 12</title>
</head>
<BODY BGCOLOR=#C0C0C0 TEXT=#000000 LINK=#0000FF VLINK=#0020F0
ALINK=#FF0000 BACKGROUND="../gx/spirbind.gif">
<table width=100%>
<tr><td><img src="../gx/blank.gif" width=50></td>
<td>
<H4>"Linux Gazette...<I>making Linux just a little more fun!</I>
"</H4>
<P> <hr> <P>
<!-- QUICK TIPS SECTION ================================================== -->
<center>
<H1><A NAME="tips"><IMG ALIGN=MIDDLE ALT="" SRC="../gx/twocent.gif">
More 2¢ Tips!</A></H1> <BR>
Send Linux Tips and Tricks to <A HREF="mailto:gazette@ssc.com">
gazette@ssc.com
</A></center>
<p><hr><p>
<H3>Contents:</H3>
<ul>
<li><a HREF="./lg_tips12.html#dmesg">Boot Information Display</a>
<li><a HREF="./lg_tips12.html#console">Console Tricks</a>
<li><a HREF="./lg_tips12.html#fire">Firewalling / Masquerading with 2.0.xx</a>
<li><a HREF="./lg_tips12.html#ftp">FTP and /etc/shells</a>
<li><a HREF="./lg_tips12.html#adm">How to Truncate /var/adm/messages</a>
<li><a HREF="./lg_tips12.html#html">HTML, Use of BODY Attributes</a>
<li><a HREF="./lg_tips12.html#lowerit">lowerit Shell Script</a>
<li><a HREF="./lg_tips12.html#user">Removing Users</a>
<li><a HREF="./lg_tips12.html#pass">Root and Passwords</a>
<li><a HREF="./lg_tips12.html#talk">Talk Daemon and Dynamic Addresses</a>
<li><a HREF="./lg_tips12.html#tar">tar Tricks</a>
</ul>
<P> <hr> <P>
<!--================================================================-->
</td> </tr> </table>
<a name="dmesg"><p></a>
<table>
<td><img src="../gx/blank.gif" width=50></td>
<td>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif"><a name="dmesg">
Boot Information Display
</a></H3>
<P>
Date: Fri, 1 Nov 1996 09:58:52 -0800 (PST)<BR>
From: Laurie Lynne Tucker <BR>
<P>
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.
<P> <hr> <P>
<!--================================================================-->
</td> </tr> </table>
<a name="console"><p></a>
<table>
<td><img src="../gx/blank.gif" width=50></td>
<td>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif"><a name="console">A 2
Cent Console Trick</a></H3>
<P>
Date: Fri, 08 Nov 1996 03:42:27 -0800 <BR>
From: Igor Markov <A HREF="mailto:imarkov@math.ucla.edu">imarkov@math.ucla.edu</A><BR>
Organization: UCLA, Department of Mathematics <BR>
<P>
Hi,
<P>
Here's my 2c console trick: <BR>
I put the following line into my ~/.xsession file:
<PRE>
nxterm -ls -geometry 80x5+45+705 -rv -sb -name "System mesages" -fn 5x7
-T "System messages" -e tail -f /var/log/messages &
</PRE>
and this one into my .fvwm:
<PRE>
Style "System messages" NoTitle, Sticky, WindowListSkip
</PRE>
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.
<P>
The .fvwm setup strips the title bar and does other useful things,
but is not necessary.
<P>
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?
<P>
Igor
<P> <hr> <P>
<!-- ===================================================================== -->
</td> </tr> </table>
<a name="fire"><p></a>
<table>
<td><img src="../gx/blank.gif" width=50></td>
<td>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif"><a name="fire">Firewalling / Masquerading
with 2.0.xx</a></H3>
<P>
Date: Sat, 2 Nov 1996 10:57:30 -0500 (EST) <BR>
From: Preston Brown <A HREF="mailto:pbrown@econ.yale.edu">pbrown@econ.yale.edu</A><BR>
<P>
Regarding the recent message about not being able to get IP masquerading
working with 2.0.xx kernels:
<P>
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.
<P>
ipfwadm is used to set up the information (I call it from
/etc/rc.d/rc.local at boot time):
<PRE>
# 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
</PRE>
a 'ipfwadm -F -l' (i.e. list all forwarding policies) yields:
<PRE>
IP firewall forward rules, default policy: deny
type prot source destination ports
acc/m all 192.168.2.0/24 anywhere n/a
</PRE>
Indicating that all is fine. Your local subnet now should be set up to
talk to the outside world just fine.
<P>
--- <BR>
-Preston Brown, preston.brown@yale.edu
<P> <hr> <P>
<!--================================================================-->
</td> </tr> </table>
<a name="ftp"><p></a>
<table>
<td><img src="../gx/blank.gif" width=50></td>
<td>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif"><a name="ftp">FTP and /etc/shells</a></H3>
<P>
Date: Fri, 1 Nov 1996 09:58:52 -0800 (PST)<BR>
From: Laurie Lynne Tucker <BR>
<P>
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!)
<P>
-- <BR>
laurie
<P>
<P> <hr> <P>
<!--================================================================-->
</td> </tr> </table>
<a name="adm"><p></a>
<table>
<td><img src="../gx/blank.gif" width=50></td>
<td>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif"><a name="adm">How to Truncate
/var/adm/messages</a></H3>
<P>
Date: Fri, 1 Nov 1996 09:58:52 -0800 (PST)<BR>
From: Alex
<P>
In answer to the question:
<blockquote>
What is the proper way to close and reopen a new /var/adm/messages file
from a running system?
</blockquote>
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.
<ol>
<li>mv /var/adm/messages /var/adm/messages.prev
<li>touch /var/adm/messages
<li>kill -1 pid-of-syslogd
</ol>
<P>
This should work on a decent Unix(like) system, and I know Linux is
one of them.
<P>
<P> <hr> <P>
<!--================================================================-->
</td> </tr> </table>
<a name="html"><p></a>
<table>
<td><img src="../gx/blank.gif" width=50></td>
<td>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif"><a name="html">
HTML, Use of BODY Attributes
</a></H3>
<P>
Date: Thu, 14 Nov 1996 12:55:15 -0500 <BR>
From: "Michael O'Keefe", <A HREF="mailto:michael.okeefe@lmc.ericsson.se">
michael.okeefe@lmc.ericsson.se</A><BR>
Organization: Ericsson Research Canada <BR>
<P>
G'day,
<P>
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.
<P>
The default <BODY> tag for Netscape, Mosaic and MSIE is
<BODY BGCOLOR=#C0C0C0 TEXT=#000000 LINK=#0000FF VLINK=#0020F0
ALINK=#FF0000>
<P>
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.
<P>
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
<PRE>
--
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?)_/_\|_,
</PRE>
<P> <hr> <P>
<!--================================================================-->
</td> </tr> </table>
<a name="lowerit"><p></a>
<table>
<td><img src="../gx/blank.gif" width=50></td>
<td>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif"><a name="lowerit">"lowerit" Shell Script</a></H3>
<P>
Date: Fri, 1 Nov 1996 09:58:52 -0800 (PST)<BR>
From: Phil Hughes, <A HREF="mailto:fyl@ssc.com">fyl@ssc.com</A><BR>
<P>
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.
<PRE>
--------------------------- 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
</PRE>
<P> <hr> <P>
<!--================================================================-->
</td> </tr> </table>
<a name="user"><p></a>
<table>
<td><img src="../gx/blank.gif" width=50></td>
<td>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif"><a name="user">
Removing Users
</a></H3>
<P>
Date: 11 Nov 1996 18:54:02 GMT <BR>
From: Geoff Short, <A HREF="mailto:grs100@york.ac.uk">grs100@york.ac.uk</A><BR>
<P>
To remove users do the following:
<P>
Simple setups:
<ul>
<li>Delete password entry for user from /etc/passwd
<li>Remove user's files using rm -r /home/user
<li>Reboot (if any processes still running)
</ul>
More complex setups:
<ul>
<li>http://kipper.york.ac.uk/rmuser.html
</ul>
Geoff
<PRE>
----------------------------------------------------------------------------
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
----------------------------------------------------------------------------
</PRE>
<P> <hr> <P>
<!--================================================================-->
</td> </tr> </table>
<a name="pass"><p></a>
<table>
<td><img src="../gx/blank.gif" width=50></td>
<td>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif"><a name="pass">Root and Passwords</a></H3>
<P>
Date: Fri, 1 Nov 1996 09:58:52 -0800 (PST)<BR>
From: Steve Mann <A HREF="mailto:smann@ultrix.ramapo.edu">smann@ultrix.ramapo.edu</A><BR>
Subject: Re: Root and passwords
<P>
If you have forgotten your root password:
<ol>
<li>Use a boot disk.
<li>Login as root.
<li>Mount the partition with your Linux.
<li>Edit the second field, which is the encrypted password, of /etc/passwd
to show nothing. It would look something like this:
<PRE>
root::0:0:root,,,:/:/bin/zsh
</PRE>
instead of something like this:
<PRE>
wimpy:GoqTFXl3f:0:0:Steve:/root:/bin/zsh
</PRE>
</ol>
You should then be able to login as root with no password at all.
<P>
Steve
<PRE>
==================================================================
/ 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 /
=================================================================
</PRE>
<P> <hr> <P>
<!--================================================================-->
</td> </tr> </table>
<a name="talk"><p></a>
<table>
<td><img src="../gx/blank.gif" width=50></td>
<td>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif"><a name="talk">
Talk Daemon and Dynamic Addresses
</a></H3>
<P>
Date: 11 Nov 1996 16:33:02 GMT <BR>
From: Adam Jenkins, <A HREF="mailto:ajenkins@kalgoorlie.cs.umass.edu">
ajenkins@kalgoorlie.cs.umass.edu </A><BR>
Organization: CMPSCI Department, UMass Amherst <BR>
<P>
Having problems sending a talk request to an IP-address other than your own?
<P>
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:
<P>
host 128.119.220.0a
<P>
Prints out a name. Use it in:
<P>
hostname name.domain.edu
<P>
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.
<P>
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.
<P>
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.
<P> <hr> <P>
<!--================================================================-->
</td> </tr> </table>
<a name="tar"><p></a>
<table>
<td><img src="../gx/blank.gif" width=50></td>
<td>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif"><a name="tar">tar Tricks</a></H3>
<P>
Date: Tue, 12 Nov 1996 15:01:58 +0000 <BR>
From: Dominic Binks <A HREF="mailto:dominic.binks@aethos.co.uk">dominic.binks@aethos.co.uk</A><BR>
Organization: AEthos Communication Systems Ltd. <BR>
<P>
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
<PRE>
tar -tfvz file.tar.gz | tr -s ' ' | cut -d ' ' -f8 | less
</PRE>
can be written more concisely
<PRE>
tar tfz file.tar.gz | less
</PRE>
Also you can use wild cards so
<PRE>
tar tfz file.tar.gz *README*
</PRE>
will list all readmes in the file.
<P>
Finally two last pieces of useful Unix magic.
<PRE>
tar cfv - dir
</PRE>
will tar the directory dir and send the output to standard output. One
piece of magic liked by Unix gurus is
<PRE>
tar cfv - dir | (cd dir2; tar xf -)
</PRE>
which copies one directory hierarchy to another location.
<P>
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.
<P>
One final tip for all UNIX newbies: you got a file which unix will not
allow you to delete.
<PRE>
rm -- 'file'
</PRE>
will get rid of it. In general -- terminates argument processing so
that everything following is passed directly to the executable.
<P>
Have fun
<P>
Dominic Binks
<P> <hr> <P>
<!--================================================================-->
<A HREF="./lg_toc12.html"><IMG SRC="../gx/indexnew.gif" ALT="[ TABLE OF
CONTENTS ]"></A> <A HREF="../index.html"><IMG SRC="../gx/homenew.gif"
ALT="[ FRONT PAGE ]"></A> <A HREF="lg_mail12.html"><IMG SRC="../gx/back2.gif" ALT=" Back "></A>
<A HREF="lg_bytes12.html"><IMG SRC="../gx/fwd.gif" ALT=" Next "></A>
<P> <hr> <P>
<h5>This page maintained by the Editor of <I>Linux Gazette</I>,
<A HREF="mailto: gazette@ssc.com">gazette@ssc.com</A><BR>
Copyright © 1996 Specialized Systems Consultants, Inc. </H5>
<P>
</td></tr></table>
</body>
</html>
|