������� Linux Tips HOWTO
 Paul Anderson, [email protected]
 v3.1, 26 ��������� 1997

 ��� �� HOWTO ������� ���������� ��� �������������, �� �����
 ������ �� ������ ��� ����� �� Linux ��������.
 ______________________________________________________________________

 Table of Contents


 1. �������

 2. ������� ����������

    2.1 ������ Syslog ���
    2.2 Script ��� �� ������� �� ���������� HOWTOs.
    2.3 ������ ������ �������� �����;;;
    2.4 ��������� ������� ��� �� ���������� �� log ����� ���.
    2.5 ������ Script ��� �� ���������� �� Core �����.
    2.6 ����������� �������� ����� ������ �����s.
    2.7 ������ ��� ���������� �������� �� ����.
    2.8 �� Linux Gazette
    2.9 ������� ��� patch ��� �� GNU Make 3.70 ��� �� �������� �� ��������� �� VPATH.
    2.10 �� ������ �� ������ �� �� ����� fsck �� ���� ������������;
    2.11 �� �� ������� �� fscks �� ����������� �� "device busy" ��� ��� ��� �������������.
    2.12 �� �� ������ �� ��������� ����� ��� ����� ���.
    2.13 �� �� ������ ������� ��� �� ������ �������� ��� �� ���������.
    2.14 ���� ����� ��� �� ������ ���� �� ������ ����� ��� ��� ����������� �������� ������.
    2.15 ��� script ��� �� ��������� �� ����� autosave ��� backup �� ��������� ������ �����������.
    2.16 �� �� ������ ���� ��������� ������� ��� ���������� �����.
    2.17 ��������� �� vi ��� ������������� �� C ,
    2.18 ����� �� sendmail ������� ��� 5 ����� ���� ��� �������� ��� RedHat;
    2.19 �� ����� �� RedHat ��� �� ������������ ��� color-ls;
    2.20 �� ����� ���� ���������� ��� /usr/lib ��� ��� ����������� ��������;

 3. ����������� ����������

    3.1 ����������� �� swap partitions ����� Linux ��� Windows.
    3.2 ����������� Undelete.
    3.3 �� �� ��������������� �� ������ flag.
    3.4 ��� ������ ��� �� �� �� ������������ ��� �����.
    3.5 ��������� ��� �� ������ �� ����� ��� ������� �� ����� ��������.
    3.6 ������� ���������� ��� ���� sysadmins.
    3.7 �� �� �������� �� xdm's chooser ��� ������� host.
    3.8 ���� ��� ��������� ���������


 ______________________________________________________________________

 1.  �������

 ���� ������ ��� Linux Tips HOWTO, ��� ����� �� ���������� ��� ���
 ���������������� �� �� ����� �� Linux ��� �������. ��� ��� �� ��
 ����� ���������� �� ������ ��'�� ����� ��, ��� ������� �� ��
 ���� Tips-HOWTO (�����, ������, �� ���� �� ���� ������ �������,
 ����;).  ������� ��, �����, ���� ��� ���������� ��� ������ ��������
 ������� ��� ������� ���� �� ������ �� ��� ������� ��� ������
 Tips-HOWTO.

 Paul Anderson ���������--Linux TIPS HOWTO

 [email protected]



 2.  ������� ����������

 2.1.  ������ Syslog ��� Paul Anderson, ��������� �� Tips-HOWTO

 ������� �� ����� /etc/syslog.conf, ��� ��������� ��� ������� ������:


      # Dump everything on tty8
      *.*                                     /dev/tty8




 �������������: ��� ������� � ��������������� TABS! ��� syslog ���
 ������ �� ����...


 2.2.  Script ��� �� ������� �� ���������� HOWTOs. Didier Juges,
 [email protected]


 ��' ��� ��� ������ ���� ����, ������ �� �� ���� script ��
 ��������� �� ������ ��� �� �������� ������� howto.  �� howto �����
 �� ���������� ��� /usr/doc/faq/howto/ ��� ����� ����������. ��
 ������ �� ����� ����� XXX-HOWTO.gz, ��� XXX ����� �� ���� ��
 howto.  ���������� �� script �� ����� "howto" ���� �������� the
 /usr/local/sbin :


      ______________________________________________________________________
      #!/bin/sh
      if [ "$1" = "" ]; then
          ls /usr/doc/faq/howto | less
      else
          gunzip -c /usr/doc/faq/howto/$1-HOWTO.gz | less
      fi
      ______________________________________________________________________




 ���� �������� ����� ����������, �������� � ��������� �� ���������
 ����� howto. ���� �������� �� ��������� �� ���� ����� �� �������
 �� ����� (���� ��� ����), �� ����������� (�������� �� ����
 ����� ������) ��� ���� �������� �� �������.

 ��� ����������, ��� �� ����� �� ������� Serial-HOWTO.gz , �����:

 $ howto Serial



 2.3.  ������ ������ �������� �����;;; Hans Zoebelein,  zocki@gold�
 fish.cube.net

 �������� ��� ���� script �� ����� ������ ��������� �� ������
 ������ �������� ����� ���������� �� ��������� ���������� ��� mount
 (������, cdrom, �������...)

 �� � ����� �����������, ������� ��� ����� ���� X ���������� ����
 ���� ��� ��������� 1 ����� �� mail ��� ���� ������ �����.





 ______________________________________________________________________
 #!/bin/sh

 #
 # $Id: check_hdspace,v 1.18 1996/12/11 22:33:29 root Exp root $
 #

 #
 # Since I got mysterious error messages during compile when
 # tmp files filled up my disks, I wrote this to get a warning
 # before disks are full.
 #
 # If this stuff saved your servers from exploding,
 # send praising email to [email protected].
 # If your site burns down because of this, sorry but I
 # warned you: no comps.
 # If you really know how to handle sed, please forgive me :)
 #

 #
 # Shoot and forget: Put 'check_hdspace &' in rc.local.
 # Checks for free space on devices every $SLEEPTIME sec.
 # You even might check your floppies or tape drives. :)
 # If free space is below $MINFREE (kb), it will echo a warning
 # and send one mail for each triggering device to $MAIL_TO_ME.
 # If there is more free space than trigger limit again,
 # mail action is also armed again.
 #

 # TODO: Different $MINFREE for each device.
 # Free /*tmp dirs securely from old junk stuff if no more free space.


 DEVICES='/dev/sda2 /dev/sda8 /dev/sda9'         # device; your put disks here
 MINFREE=20480                                   # kb; below this do warning
 SLEEPTIME=10                                    # sec; sleep between checks
 MAIL_TO_ME='root@localhost'                     # fool; to whom mail warning


 # ------- no changes needed below this line (hopefully :) -------

 MINMB=0
 ISFREE=0
 MAILED=""
 let MINMB=$MINFREE/1024         # yep, we are strict :)

 while [ 1 ]; do
         DF="`/bin/df`"
                 for DEVICE in $DEVICES ; do
                 ISFREE=`echo $DF | sed s#.\*$DEVICE" "\*[0-9]\*""\*[0-9]\*" "\*## | sed s#" ".\*##`

                 if [ $ISFREE -le $MINFREE ] ; then
                         let ISMB=$ISFREE/1024
                         echo  "WARNING: $DEVICE only $ISMB mb free." >&2
                         #echo "more stuff here" >&2
                         echo -e "\a\a\a\a"

                         if [ -z  "`echo $MAILED | grep -w $DEVICE`" ] ; then
                                 echo "WARNING: $DEVICE only $ISMB mb free.      (Trigger is set to $MINMB mb)" \
                                 | mail -s "WARNING: $DEVICE only $ISMB mb free!" $MAIL_TO_ME
                                 MAILEDH="$MAILED $DEVICE"
                                 MAILED=$MAILEDH
                                 # put further action here like cleaning
                                 # up */tmp dirs...
                         fi
                         elif [ -n  "`echo $MAILED | grep -w $DEVICE`" ] ; then
                                 # Remove mailed marker if enough disk space
                                 # again. So we are ready for new mailing action.
                                 MAILEDH="`echo $MAILED  | sed s#$DEVICE##`"
                                 MAILED=$MAILEDH
                         fi

                 done
                 sleep $SLEEPTIME

 done
 ______________________________________________________________________






 2.4.  ��������� ������� ��� �� ���������� �� log ����� ���. Paul
 Anderson, ��������� �� Tips-HOWTO >

 �� ����� ��� �� �����, ���� ��� ����� �� 250 �������������, ��� 100+
 ������� �� ������� ���������� ��� UUCP.  �����, �� ������ �� �����
 ���� ����� �� ��� �� �������� logs; �� ������ �� chklogs.  �� Chklogs
 ������� �� ��� Emilio Grimaldo, [email protected], ��� �
 ������ ������ 1.8 ����� ��������� ���
 ftp.iaehv.nl:/pub/users/grimaldo/chklogs-1.8.tar.gz.  � ����������
 ������������ ����� ���� (�� ���������, ������, ��� ���������� ����
 ����������� sub).  ���� �� �������������, ��������� ��� ������
 crontab ��� ��� �������:


      # Run chklogs at 9:00PM daily.
      00 21 * * *       /usr/local/sbin/chklogs -m




 ��� ��� �� ���������������, ��� ������� �� �������� ���� �������
 ��� ����� ������������� ����� �� :)



 2.5.  [email protected] ������ Script ��� �� ���������� �� Core
 �����. Otto Hammersmith,

 ����������� ��� ����� �� ����� rmcores (� �������� �� ��������
 handle-cores) �� �� ������� ��� ������� �����:



















 ______________________________________________________________________
 #!/bin/sh
 USAGE="$0 <directory> <message-file>"

 if [ $# != 2 ] ; then
         echo $USAGE
         exit
 fi

  echo Deleting...
 find $1 -name core -atime 7 -print -exec rm {} \;

 echo e-mailing
 for name in `find $1 -name core -exec ls -l {} \; | cut -c16-24`
 do
         echo $name
         cat $2 | mail $name
 done
 ______________________________________________________________________




 ����������� ��� ������� cron �� �� ����� ���������.



 2.6.  ����������� �������� ����� ������ �����s. Alan Cox,
 [email protected]

 �������� ����� �� ��������� ��� ������� ������ ����� �� ���
 ����� �� ���� ����


      (cd /source/directory && tar cf - . ) | (cd /dest/directory && tar xvfp -)




 [ A������� �� �� /source/directory. ����� tar....���.  ���� ��
 ������� ��� ��������� �� ���������� �� directory �� ��������
 ����������.  ������� ��� Jim Dennis, [email protected], �� �� ��
 ����. -���. ]


 2.7.  [email protected] ������ ��� ���������� �������� ��
 ����. Mick Ghazey,

 ����� ��������� ���� ����� ����� �� ���������� ��������� ����
 ���������� ���; ������ �� �� �� ������.


      du -S | sort -n





 2.8.  �� Linux Gazette

 ��� ��� ����� ���� John Fisk, �� ������� �� Linux Gazette.  �����
 ��� ��������� ���������� �������� ��� ��������, ����� �����!!!  ��
 ���������� �������� �� ��������; ����� ���� ���:



 http://www.ssc.com/lg




 ��� ��� �������, �������� ��� (1) �� LG ������� �� ������� ������,
 ��� (2) ��� �� ������� ��� � John Fisk , ���� �� ��������� ��� SSC.



 2.9.  Ted Stern,  [email protected] ������� ��� patch ��� ��
 GNU Make 3.70 ��� �� �������� �� ��������� �� VPATH.

 ��� ��� �� ��� ������ ������� �� �� �������, ���� ������ ���
 "�������������" �� GNU make ������ 3.70 �� ����� �� �� ������.
 ����� ��� �� VPATH ������������ �������� �� ����� �� ����� �����
 �����. ������ ��� ���������� ������ patch �� �������� ��
 �������, �� ����� �������� �� ������ �� ��� Paul D. Smith
 <[email protected]>.  ���� ������� ��� ��������� ��� �� patch
 ���� �� ���� ���������� �� GNU make ��� newsgroup gnu.utils.bug.
 ������, ����� �� �� patch ��� ��� ���� compile �� gmake �� ����
 ������ �� �� �������.


 2.10.  �� ������ �� ������ �� �� ����� fsck �� ���� ������������;
 Dale Lutz,  [email protected]

 Q:  �� ������ �� e2fsck �� ������ �� ����� �� ���� ���� �� ���
 boot.

 A:  ���� ���������� ��� �����, �� ������ ����� ���������� ���
 '������' ��� ���� � ������ ��� �� �������� �� ���� ��������.  ��� ��
 �� �������� �� ������ ��:

 rdev -R /zImage 1

 ��� �������� ��� ����� �� �� �� ������� ��� �� ������ �����
 ����� ������.

 �������: �� �������������� lilo, ��� ��������� �� read-only ����
 ����������� �� ��� ����� ������� �� lilo (����� ���
 /etc/lilo.conf)


 2.11.  �� �� ������� �� fscks �� ����������� �� "device busy"
 ��� ��� ��� �������������. Jon Tombs,  [email protected]

 �� ������� ��� ���� device busy ���� �� shutdown �� ����� ��
 ������ ����� �� ���������� fsck ���� ��� ������������, ������ ���
 ����� ������ :

 ��������� ��� ������� ������ ��� /etc/rc.d/init.d/halt �
 /etc/rc.d/rc.0


      mount -o remount,ro /mount.dir




 ��� ��� �� ������������ (mounted) �������� ����� ���� �� /, ����
 ��� ����� umount -a. ��� �������� ��� ��, ��� ������ ���, �� shut�
 down ������ �� ������� ���� ��� ���������� ��� �������������� ���
 ������ �� ����� ���� ������� ���� ������������. ���� ��������� ���
 ���� ���� ������������.

 2.12.  �� �� ������ �� ��������� ����� ��� ����� ���.

 Simon Amor, [email protected]



      ls -l | sort +4n




 �, ��' ���� �� ����� ���������� scrunched ��� ����, ������ �� �����
 ���� ���� ������ ��� ����:



      cd /
      ls -lR | sort +4n





 2.13.  �� �� ������ ������� ��� �� ������ �������� ��� ��
 ���������. Mike Dickey,  [email protected]



      ______________________________________________________________________
              #!/bin/sh
              # /usr/local/bin/print
              # a simple formatted printout, to enable someone to
              # 3-hole punch the output and put it in a binder

              cat $1 | pr -t -o 5 -w 85 | lpr
      ______________________________________________________________________





 2.14.  Raul Deluth Miller,  [email protected] ���� ����� ��� ��
 ������ ���� �� ������ ����� ��� ��� ����������� �������� ������.

 ������ �� �� script 'forall'.  �������������� �� �� ���� :


      forall /usr/include grep -i ioctl
      forall /usr/man grep ioctl




 �� �� script forall:












 ______________________________________________________________________
 #!/bin/sh
 if [ 1 = `expr 2 \> $#` ]
 then
         echo Usage: $0 dir cmd [optargs]
         exit 1
 fi
 dir=$1
 shift
 find $dir -type f -print | xargs "$@"
 ______________________________________________________________________





 2.15.  Barry Tolnas,  [email protected] ��� script ��� ��
 ��������� �� ����� autosave ��� backup �� ��������� ������
 �����������.

 ��� ��� �������� ��-������ �� ���������� ���������� ��� �������
 ��� ������� �������� �� ����� emacs auto-save (#) ��� backup
 (~), �� ����� .o , ��� �� TeX .log. ������ �������� �� ����� .tex
 ��� �� README. �� �� �������� 'squeeze' ��� ������ ��.


      ______________________________________________________________________
      #!/bin/sh
      #SQUEEZE removes unnecessary files and compresses .tex and README files
      #By Barry tolnas, [email protected]
      #
      echo squeezing $PWD
      find  $PWD \( -name \*~ -or -name \*.o -or -name \*.log -or -name \*\#\) -exec
      rm -f {} \;
      find $PWD \( -name \*.tex -or -name \*README\* -or -name \*readme\* \) -exec gzip -9 {} \;
      ______________________________________________________________________





 2.16.  [email protected] �� �� ������ ���� ��������� ������� ���
 ���������� �����. Simon Amor,



      ps -aux | sort +4n




 -H-


      ps -aux | sort +5n





 2.17.  ��������� �� vi ��� ������������� �� C , Paul Anderson, Tips-
 HOWTO ���������

 ��� �������������� ��� �� C ���� ������ �� ����, ��� ���� ����
 ��� �� ������� �� vi ���� �� ����� ����� �� �� C. ������ �� �����
 �� .exrc:
      ______________________________________________________________________
      set autoindent
      set shiftwidth=4
      set backspace=2
      set ruler
      ______________________________________________________________________




 �� ����� ��; �� autoindent ��������� �� vi �� ����� indent ������
 ���� ������ �� �������� ��� ���� �� ����� indent, �� shiftwidth
 ����� ��� ������� �� ^T (tab) �� 4 ����, �� backspace ����� ��
 backspace mode, ��� �� ruler ������ ��� ����� �������.  �� ������,
 ��� ��� �� ���� �� ��� ����������� ����� �������, �� ���� ��� 20,
 �������������� ��:



      ______________________________________________________________________
      vi +20 myfile.c
      ______________________________________________________________________





 2.18.  [email protected] ����� �� sendmail ������� ��� 5 �����
 ���� ��� �������� ��� RedHat; Paul Anderson,

 ��� ����� ��� ���� ���� �������, �� ������ �� ����� FAQ.  ���
 ��� �� �� RedHat ������ �� �� bug ��� ������� ���, ���� ��������
 �� �� ��������� ��� ���� ���.  �� ��������� ��� ����� /etc/hosts ,
 �� ����� ��� ������� ���� ��� :


      127.0.0.1               localhost       yourbox




 ���� ������ �� sendmail, ����� ��� hostname �� ���� (�� ��� ���
 ��������, �� yourbox).  ���� ������� ��� �� IP �� yourbox �����
 127.0.0.1, �� ��� ������ ��� sendmail, ��� ����� ����. ������� ��
 �� ��� ���� ����� ��� �� ����������� ��� �� ����������. �� ��
 ��������� �� �� ������� ����� ��� ���, ������� �� �����
 /etc/hosts ��� ������� �� �� ���� ��� ��:


      127.0.0.1               localhost
      10.56.142.1             yourbox






 2.19.  �� ����� �� RedHat ��� �� ������������ ��� color-ls; Paul
 Anderson,  [email protected]

 � ������� RedHat ������ �� color-ls, ������� ��� ��� ����� ��� ��
 ������� ��� ����� �� ������. �� �� �� �� ���������.

 ����, ����� eval `DIRCOLORS`


 ����, alias ls='ls --color=yes'

 ��� ��������� �� 'alias.....' ��� ����� /etc/bashrc




 2.20.  [email protected] �� ����� ���� ���������� ���
 /usr/lib ��� ��� ����������� ��������; Pawel Veselow,

 �� ������ �� ������ compile ��� �� ������ link ��� ���������� ��
 ����������; ��� �� gcc reports ����� ������ ���������...  �� ���
 ������ ������ �� �� ���� �� �� ������:


      for i in *; do echo $i:;nm $i|grep tgetnum 2>/dev/null;done




 ��� tgetnum ����� �� ����� ��� ��������� �� ������.




 3.  ����������� ����������

 3.1.  ����������� �� swap partitions ����� Linux ��� Windows. Tony
 Acero,  [email protected]


 1. ��������� �� partition ��� dos partition, ��� ����������� ��
    ����� swap �� Windows �� ��, ���� ��� ������� ���� �� windows.
    (������ �� ��������� �� ����� swap ������ ��� ��� ��� ���, ����
    �� ��������� ����).

 2. ��������� linux ��� ���� �� partition �� ��� �����.  ���
    ���������� �� �� partition ���� �� /dev/hda8:


      dd if=/dev/hda8 of=/etc/dosswap




 3. �������� �� ����� swap �� dos. ��� ��� ����� ���� ��� 0 ��
    ��������� ��� ����


      gzip -9 /etc/dosswap




 4. ��������� �� ������� ��� ����� /etc/rc ��� �� ������������� ���
    �� ������� �� swap ���� ��� �� Linux:

    XXXXX ����� � ������ �� ������ �� swap partition


      mkswap /dev/hda8 XXXXX
      swapon -av




 ����������� ��� ���������� ��� ������ ��� �� swap partition ���
 ����� /etc/fstab

 5. �� �� ������ ��� init/reboot ����������� /etc/brc � /sbin/brc
    ��������� �� ������� ��� /etc/brc, ����� ����� �� �� �� ���� ����
    ������ �� ���������� �� dos|os/2 ��� ������ �� ���������� �� swap
    partition ��� ���� ������ ��� dos/windows:



      swapoff -av
      zcat /etc/dosswap.gz | dd of=/dev/hda8 bs=1k count=100




 # Note that this only writes the first 100 blocks back to the parti�
 tion. I've found empirically that this is sufficient

 >>  ���� ����� �� ������������� ��� �� ������������� ��� �� �������;

 �����������: ������������� �������� ���� �� �� ����� ���.

 �����������: �� �� ���� 5 �� ������� ������, ������ �� �������� ��
 �� ������ �� �� ����, ��� ��������� �� ���������� ��������� ���� ���
 nanosecond :-)


 3.2.  ����������� Undelete. Michael Hamilton,  [email protected]

 �� ��� ��� �� ������ �� ������������ ������� �����.

 undelete ����� ������� ��� ������������.

 �� ���� ����� ������� ��� text �����, ��� ����������, ������ email, �
 �� ������������ ���� �������� ����������������� ��������  , ������
 �� �� ������� ���.  �� �� ����� �� �������� ��� �����, ���� ���� �.�
 ��� ���������� �� 30 ����������, ������ �� ��������� �� ��
 ���������� ���� ���� ��������� �� �����.

 �������� �� ��������������� ��� ������ grep ��� �� ����� �� raw disk
 partition ��� �� ��������� �� �����.

 ��� ����������, ������, ������ ���� ����� ��� ������� ��� email.
 ����, ��������� ����� ����������� �������� �� ������� �� ����������
 �� partition: �� ��� ��� �������� ���� ������ �� �������� �����
 � �� ��� ����������� (compile) ���.  �� ����� ����������, �����
 ���������� ���� ��� �� ������� �� ������ �� single user mode, ���
 �� ��������� (unmount) �� ������ �����.

 ������������� ��� ��� ������ egrep ��� partition �� �����:  ����
 �������� �� �� email ����� ���� ��� /usr/local/home/michael/, ����
 �� �� output �� df, ���� ��� ���� ��� /dev/hdb5


        sputnik3:~ % df
          Filesystem         1024-blocks  Used Available Capacity Mounted on
          /dev/hda3              18621    9759     7901     55%   /
          /dev/hdb3             308852  258443    34458     88%   /usr
          /dev/hdb5             466896  407062    35720     92%   /usr/local

          sputnik3:~ % su
          Password:
          [michael@sputnik3 michael]# egrep -50 'ftp.+COL' /dev/hdb5 > /tmp/x


 ��� ����� ���������� ���������� ���� ���� �� ��� ����������� ��
 �����, ���� ��������� �� ������ ��� ���������� �� ������ ���
 ������� ���� �� ����� �� ������� return.  �� ��� ��� �������� ��
 email ������� �� ���� 'ftp' ����������� �� ������ text �� ��
 ��������� �� 'COL'.  �� ����� ���� ������ 20 �������, ����
 ������������� �� -50 ��� �� ��� ���� ��� ������ �� �� �� �����.
 ��� ������� ��� �������������� �� -3000 ��� �� ����� ������� ��� ��
 ��� ���� ��� ������� �� ������ ������ �����.  ������� ��� �����
 ��� egrep �� ��� ��������� partition �����- ���� ������ �� ����
 ��� �� �� ���� ����� �� ����.

 ���� ������������� ��� ������ strings ��� �� �� �������� �� ������
 ��� �����


         strings /tmp/x | less





 To email ���� ���������� ����.

 ���� � ������� ��� ����� ��� �� ���������� �� ���, ����, � �����, ��
 ���� �� ����� ������ �� ��� ��� �����������������.

 ��� �� ��� ����� ������ ������� ��� �� �������� �� ������ ����
 �������. �� �������� �������� ������ �� ����� ������������ �����,
 � ����� �� ���������� ������ �� ��� ��� ��������������. ����
 ����������, ��� ������� �� ������� �� ���� ��� �� ��� ������� ���
 ���� ���� �� ����������� �� ���������� ��� �����.

 ��� ������ �� �� �����, �� �� ��� ������ ����� �� ����� ������
 ���������� �� �������� ����� - ����� ���� ���� ���� �������
 ����� �������.  �� �,�� ���� ������ �� ��� ������ ��� ��� ���
 �� ����� ��������� �������, ��� �������� �������� �� ��� floppy,
 ���� �� ���������� �� �� ��� ��� ��� ���.



 3.3.  �� �� ��������������� �� ������ flag. Jim Dennis,
 [email protected]

 ��������������� �� ������ Flag

 ����� ���� ������������� ��� �������� �� ������ ��� ��������� ���
 /bin, /sbin/, /usr/bin, /usr/sbin ��� /usr/lib (��� ������ of the
 other usual suspects ��� ����� ��������� ����� ��� 'chattr +i
 �������'.  ������ ��������� �� ����� �� ����� ��� root.  �����
 'mkdir /etc/.dist/' ��������� �� ��� �� �� /etc/ on down (�� ��
 ��� �� �� ������ �������������� �� /tmp/etcdist.tar ��� �� ����
 ��� ��������) �� ������ ��� ��������. (����������� �������� ��
 ������������ �� /etc/.dist.tar.gz) -- ��� �� �� ��������� �� ������.

 � ���� ��� ��� ��� ����� �� ��������� �� ����� �� ������ ��
 ����������� �� ������ ��� root.  �� �� ������ ��� �� ����� �� ���
 ������� ������������ (redirection operator) stray, ��� �� �� ������
 �� ������ ������ �� ��� stray ��� �� ��� ������ 'rm -fr' (��������
 ���� �� ������ ������ ������ ��� �������� ��� -- ���� �� �����������
 ��� �� ���������� �� ����� ��� �����.

 ��� ������ ����� ��� ������ ���������� �������� ��� �������
 ����������� (denial of service) ���� ������ ���� ��� ������ ��
 ����������� (��� ��� ������ ���������� ��� �� ����� ��� �� ���
 ����� ��� �� ��������� ������ ������������ SUID �� *��� ������
 ��� �������� ������ ������*).
 � ���� ������ �� �� ����� ���� ������� ��� ����� ��� ������ 'make
 install' ��  ������ ���� ���������� �� ���������.  �� ��� ����,
 ��������� ������ �� 'make install' �� ����� ��� �� �� �����.  ����
 ������� �� ��������� �� Makefile ��� �� ������ chattr -i �� �����
 �� �������� �� ������ �� ��� (��� �� ��������� ���� ������
 ������ �� ���������� �����) -- �� make ���������, ��������������
 ���� ��� ������ chattr ��� �� ����������. �������� ������ �� ��������
 ��� ��� ������� ��� �� ��������� �� ����� ��� bin's, lib's, �
 ��������� �� ��� �������� .old/ � �� �� �������� ����� � �� �� ������
 tar � ��� ����.




 3.4.  Jim Dennis,  [email protected] ��� ������ ��� �� �� ��
 ������������ ��� �����.

 ��� �� ��� ����� ������� ��� �� �� /usr/local! �
 /usr/local/`hostname`

 �� � ������� ��� ����� �� /usr/local ����� ��� ����������� ��
 /usr/local/src, /usr/local/bin ���.  ��� �������������� ��. �� �
 ������� ��� ��������� ����������� ��� ������ /usr/local ��� ������ ��
 ������ �� ������ 'mkdir /usr/local/`hostname`' ��� �� ����� ��
 'wheel' group +w �� �� (�� ��� ������ SUID ��� SGID ��� ��
 �������� ��� ���� ����� �� wheel group ������ �� ����������� �� ��
 ���� �� ����� �� ���� ��� ���, ��� ��� ��� �� ����� ��
 ������������� �� ������ ��� 'wheel' group.

 ��� ���������� ��� ��� ��� ��� *���! ���! ���!* ����� �� ���
 ������ ��� �� �� /usr/local/src/.from/$����_�_����/ (��� �� .tar �
 ����������� �����) ��� ������ �� ��� �� �� /usr/local/src (�
 .../$HOSTNAME/src).  ����������� ��� ������������ ��� �� ���
 ������ �������.  �� *������ ���������* �� ������������ ��� ���
 /bin � /usr/bin � ���� ���� -- ����� ��� symlink �� ��� ������
 ������� �� ���� ������� �� �� �� �� ������ ��������� ����.

 � ���� ��' �� -- ���� �� �� ������� ���������� ������ -- �����
 ��� ����� �� ���������� �,�� ������ �� ����� �������� �������� ���
 restore � �� ���������������� �� �������� ������ ����������������
 �� �� distribution media (����� CD ���� ����� ���).
 �������������� �� /usr/local/.from directory �������� �� ���������
 ��� ��������� ��������� (log) �� �� ���������� �� ������� ������
 -- �� ����� ������� ���� ������ ��� ���� ������������ -- ��� ������
 �� ����� ��� ���������� ���� ������ monitore ��� ������
 ���������� ������ �� �������.

 �-�� �� �� �������� �� ��� ����� (�� �� �� ����� �� �� �����
 ��� ��� ��� �������� ��) �������������� ���� �� �������� ��� ���
 ������� ��� ��� ��� ��.  ���� �� "�����" ���� ��� ������� ��
 �� ������ �� ������� "��� �������������".  ��� ����� ���� ��
 ������ ��� �� ����� ��� ����� �������� ��� ������ �� ������ ��
 ��� ����� �� *���* ����� �� �� ������������.

 ��������, �� �������� �� �� ������ ��� ������ (���� �������� ����
 �� ��� �� ���������� ���������) ��� ��� �������� �� ��� ���
 ���� -- ��� ����������� �� ������ ������� ��� ����� �������
 �� MIS, ��� ������ ��� ������ ����� ����������� ��� ������������
 ������.  ��� ��� ��� ���� ���� ��� �� ���� ������ �������
 ������������� ��� ������ *����* ��� ����� ����������� ��� ������.


 3.5.  ��������� ��� �� ������ �� ����� ��� ������� �� �����
 ��������. Justin Dossey,  [email protected]


 ���������� ������� ���������� ������� � �� ����������� �����������
 �� ������������ ��� ����� 2c tips �� ���� 12.  ��� ��� �����
 ����������� �� ���, ��� ����� �� ����:


      ______________________________________________________________________
      #!/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
      ______________________________________________________________________




 ��, �� ����� ������ script.  �� �� ����� ������ script ��� �� ���
 ��.  ��������, �� ������������� ��� ��� ������:


      for i in * ; do [ -f $i ] && mv -i $i `echo $i | tr '[A-Z]' '[a-z]'`;
      done;




 ��� ������ ������.

 � ������� �� ����� ��� �� ��������, ���� ��� ����� �� script ��
 �� ��� ���� ���� �� ����� �������� (����� �������).

 ���� ������ �������, ��� ������ �� ��� �������� ��� �������
 ������, � Geoff �� ���� ��� ���� ���� �� �������� ����.
 ������������;  �, ����� �� �� ���������� ������������ �� ���������
 ���� ���� �� �������� ��� ������.  �,�� ���������� �� ������ �����
 �� �� ���� ������.  �� ����� ���������� �� ��� ����� � �������,
 ������;  ��� irc bot;  ������� ��� ����������� ���� �� ���


      kill -9 `ps -aux |grep ^<username> |tr -s " " |cut -d " " -f2`




 ����������, �� username ����� foo


      kill -9 `ps -aux |grep ^foo |tr -s " " |cut -d " " -f2`




 ��� �� ���������� �� ��, �� ��������� ��� �������� ���� ��
 root.


 � ��� �� ������� ��� Gazette ����� � ��� �����, ���� ��� ��� � ���
 �����.  �� �� LILO ��� �� loadlin, �������� �� ����� ��� ���������
 ��� boot �� ���������� ��� ������ (single) ��� ������ �������� ���
 �������������� shell ����� login � password prompt.  �� ����,
 �������� �� �������� � �� ��������� passwords ���� �� ������ "init
 3" �� ���������� �� ��������� �������� ������ (multiuser mode).
 ������ �������������: 1 �� ��� ���� ���� ������ �������������: 2


 Justin Dossey



 3.6.  Jim Dennis,  [email protected] ������� ���������� ��� ����
 sysadmins.

 ����������� ��� ��������� ��� /README.`hostname` ���/� ���
 /etc/README.`hostname` [� ������ /usr/local/etc/README.`hostname`
 -Maint. ]

 ���������, �������� ��������� �� *��� ���� ����* ��� ����������
 �� ��������� �� ��� online log �����.  �������� �� �������� ��� vi
 /README.$(hostname). ��� ������ ��� ����� �� root  /bash_logout.
 ���� ����� ����� �� �� ������ �� ����� �� ������ su � ��� sudo
 script �� ����� ���� ��� �� �������:


                      function exit \
                              { unset exit; exit; \
                                cat ~/tmp/session.$(date +%y%m%d) \
                                >> /README.$(hostname) && \
                                vi /README.$(hostname)
                                }
                      script -a ~/tmp/session.$(date +%y%m%d)
                      /bin/su.org -




 (�������������� ��� ������ typescript ��� �� ����������� ��� session
 log ��� ����������� ��� �������� �� �� ��������� ��� �� ���������
 ������ �� log).

 ���������� ��� ��� �� ���������� �� ��� �������� �������
 ��������� -- �� �������� �� ��� ���� ����������� �� �� ���.
 �������, �� ������ �� ��� ��� ���� (���� �� ������ �� ����� ���
 ����� ������ (prototype) �� scripts ��� �� shell ��������� ���
 ��� �������).  ��� ������ �� �� ������� ����� � ���� � 'script'
 ������.  ����� ��� �� ������ �� ��� ��� ����� ��� �� ������� ��
 ���������� ��� ������ ������ (��� �� ������/������ �� script ��
 ��������� �� �� ������ ������) ���� �� ������ ��� �� ��
 ����������).

 � �������� �� ������ (��' �� �� ���):

 �� path �� Root �� ������ �� ������� �� 'PATH= /bin'

 ���� ��� ������ ���� ��� path �� root.  �,�� ����� � root ��������
 �� ��� symlink �� ��  /bin � �� ��� alias � shell ������, � �����
 ��� script � ��� ���������� ���  /bin, � ������� �� �� ������ path.

 ��� ����� ��� ������ �� ����� ��� root �� ������� (������� �����
 �����) ��� ����������� �� ����������.  � ������� admin ��� host
 ����� ������ �� ������� ��������� ��� �� ���� ��  /bin ��� ��
 �����  /.*history �������� patterns ��� �������.

 � ���������� ������������������ admin �� ��������� ��������� ��
 ������ �� ��������������, ���� ��� ����� ������ ������/������ ��
 ������� , ��� ����������� ��� ��� ������ "root" �� ��������� ��
 ������ �� ������� �������� (� �������� ����� �����������,
 MTA's ��� ���� ������ ��������� (interactive) ����������� �� ���������
 �������������� scripting �� ����� *������* �� ��������� �� ������
 ����� � ����� �������� -- ��� �� ���� vi ./.exrc ��� �� emacs
 ./.emacs ��� �� ���� ���������� ����� $EXINIT ��� �� �����������
 ������������ ���������� (header/footer macros)).  ���������� ��
 ������� ��� �� ��� ������ �� ������ �� ���� ���:


                      cp $data $some_users_home/tmp
                      su -c $origcommand $whatever_switches
                      cp $some_users_home/tmp $data




 (...��� �� ������������ ��������� �� ��� ������).

 ����� �� ��������� ���� ��������� ����������� ��� �� ����� � ��
 "single" ����� �������� �� ������ -- ���� ����� ��� ���� �������
 ��� �� ��������� ��� ��������� �������� ������ -- ������ ��� ���
 ������ ������ ����������� (��� �� ��� netcom).



 3.7.  �� �� �������� �� xdm's chooser ��� ������� host. Arrigo Tri�
 ulzi,  [email protected]


 1. ��������� �� ����� �� ������� �� xdm ��� ������ ��
    /etc/rc/rc.6 � /etc/rc.local) ���� ���� �� ������� ��� �������
    ������� ��� ����� ��������� �� xdm.



      /usr/bin/X11/xdm
      exec /usr/bin/X11/X -indirect hostname




 2. ������� �� /usr/lib/X11/xdm/Xservers ��� ����� �� ���� �� ������
    �� ������ �� server ��� ����� ������� (�.�. ��������� �� 0:)

 3. ������������� �� ������� ��� you're home and away.


 ��� �� ������� ���� ���������� ���������� �� �� ���������� ��� ��
 ��� �� subnet �� ���������� ������ ��� ������� ��� �� �������
 ��� �� ����������.

 �������������: �� �� ���� SLS (1.1.1) ��� ������ ��� �������� ��
 ����� ��� -nodaemon ���� �� ������ xdm -- �� �� ������ ���
 �������������� �������.


 3.8.  ���� ��� ��������� ���������

 ��� ����, ������������, ���������, ���������� ���� ��� ���������
 ��������� ��� �� HOWTO, ������� email ���� ���� ������ :
 [email protected] � ���� ������� �������� : [email protected] ���
 ����������� : [email protected]