Ellhniko Linux Tips HOWTO Paul Anderson, paul@geeky1.ebtech.net v3.1, 26 Dekembrioy 1997 Ayto to HOWTO periexei ypodeijeis kai peiramatismous, poy einai duskolo na bre8oun kai kanoyn to Linux omorfotero. ______________________________________________________________________ Table of Contents 1. Eisagwgh 2. Suntomes Ypodeijeis 2.1 Proxeiro Syslog Tryk 2.2 Script gia na blepete ta sympiesmena HOWTOs. 2.3 Yparxei arketos eleu8eros xwros;;; 2.4 Boh8htikh efarmogh gia na ka8arizete ta log arxeia sas. 2.5 Proxeiro Script gia na ka8arizete ta Core arxeia. 2.6 Metaferontas katalogoys metaju susthma arxeiwns. 2.7 Breite toys megaluteroys katalogoys poy exete. 2.8 To Linux Gazette 2.9 Deikths sto patch gia to GNU Make 3.70 gia na allajete th symperifora toy VPATH. 2.10 Pws stamatw to susthma moy na kanei fsck se ka8e epanekkinhsh; 2.11 Pws na apofugete ta fscks poy prokalountai apo "device busy" thn wra ths epanekkinhshs. 2.12 Pws na breite ta megalutera arxeia sto disko sas. 2.13 Pws na typwsete selides kai na afhsete peri8wrio gia to diakoreyth. 2.14 Enas tropos gia na caxnete mesa se dendra arxeiwn gia mia sygkekrimenh kanonikh ekfrash. 2.15 Ena script gia na ka8arizei ta arxeia autosave kai backup poy dhmioyrgoun diafora programmata. 2.16 Pws na breite poia diergasia apaitei thn perissoterh mnhmh. 2.17 Ejopliste to vi gia programmatismo se C , 2.18 Giati to sendmail kollaei epi 5 lepta kata thn ekkinhsh sto RedHat; 2.19 Pws ry8mizw to RedHat gia na xrhsimopoiei thn color-ls; 2.20 Pws briskw poia biblio8hkh sto /usr/lib exei mia sygkekrimenh synarthsh; 3. Leptomereis Ypodeijeis 3.1 Moirazontas ta swap partitions metaju Linux kai Windows. 3.2 Apelpismena Undelete. 3.3 Pws na xrhsimopoihsete to sta8ero flag. 3.4 Mia protash gia to pou na topo8ethsete nea arxeia. 3.5 Metatrecte ola ta onomata twn arxeiwn enos katalogoy se mikra grammata. 3.6 Merikes ypodeijeis gia neoys sysadmins. 3.7 Pws na ry8misete to xdm's chooser gia epilogh host. 3.8 Peri ths Ellhnikhs Metafrashs ______________________________________________________________________ 1. Eisagwgh Kalws hr8ate sto Linux Tips HOWTO, mia lista apo sympa8htika tryk kai beltistopoihseis poy 8a kanoyn to Linux pio eyxaristo. Ola osa exw edw einai ypodeijeis poy ebgala ap'to kefali moy, kai symboyles apo to palio Tips-HOWTO (giati, allwste, na bgalw ejw ka8ws prepei symboyles, swsta;). Steilte moy, loipon, oles tis agaphmenes sas mikres xrhsimes symboyles kai odhgies wste na mporesw na tis enswmatwsw sto epomeno Tips-HOWTO. Paul Anderson Synthrhths--Linux TIPS HOWTO panderso@ebtech.net 2. Suntomes Ypodeijeis 2.1. Proxeiro Syslog Tryk Paul Anderson, Synthrhths toy Tips-HOWTO Anoijte to arxeio /etc/syslog.conf, kai pros8este thn parakatw grammh: # Dump everything on tty8 *.* /dev/tty8 PROEIDOPOIHSH: MHN 3EXASETE NA XRHSIMOPOIHSETE TABS! sto syslog den aresoyn ta kena... 2.2. Script gia na blepete ta sympiesmena HOWTOs. Didier Juges, dj@destin.nfds.net Ap' ton ena arxario ston allo, proekyce ayto to mikro script poy dieykolunei to cajimo kai to diabasma keimenwn howto. Ta howto arxeia moy briskontai sto /usr/doc/faq/howto/ kai einai sympiesmena. Ta onomata twn arxeiwn einai XXX-HOWTO.gz, opoy XXX einai to 8ema toy howto. Dhmiourghsa to script me onoma "howto" ston katalogo 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 ______________________________________________________________________ Otan kaleitai xwris parametroys, emfanizei o katalogos twn dia8esimwn arxeiwn howto. Otan kaleitai me parametro to prwto tmhma toy onomatos toy arxeioy (prin thn paula), to aposympiezei (kratwntas to arxiko arxeio anepafo) kai meta emfanizei to keimeno. Gia paradeigma, gia na deite to keimeno Serial-HOWTO.gz , gracte: $ howto Serial 2.3. Yparxei arketos eleu8eros xwros;;; Hans Zoebelein, zocki@gold­ fish.cube.net Akoloy8ei ena mikro script to opoio elegxei periodika an yparxei arketos eleu8eros xwros dia8esimos se otidhpote emfanizetai sto mount (diskoi, cdrom, disketa...) An o xwros ejantleitai, typwnetai ena mhnyma ka8e X deyterolepta sthn o8onh kai stelnetai 1 mhnyma me mail gia ka8e gemath syskeyh. ______________________________________________________________________ #!/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 zocki@goldfish.cube.net. # 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. Boh8htikh efarmogh gia na ka8arizete ta log arxeia sas. Paul Anderson, Synthrhths toy Tips-HOWTO > An eiste san ki emena, exete mia lista me 250 eggegrammenoys, kai 100+ mhnumata na erxontai ka8hmerina mesw UUCP. Loipon, ti mporei na kanei enas xaker me ayta ta terastia logs; Na sthsei to chklogs. To Chklogs grafthke apo ton Emilio Grimaldo, grimaldo@panama.iaehv.nl, kai h trexoysa ekdosh 1.8 einai dia8esimh sto ftp.iaehv.nl:/pub/users/grimaldo/chklogs-1.8.tar.gz. H diadikasia egkatastashs einai aplh (8a diabasete, fysika, tis plhrofories ston ypokatalogo sub). Otan to egkatasthsete, pros8este mia eggrafh crontab san thn parakatw: # Run chklogs at 9:00PM daily. 00 21 * * * /usr/local/sbin/chklogs -m Mia kai to xrhsimopoihsate, mhn jexasete na anaferete ston syggrafea poso wraio programmataki einai ayto :) 2.5. ohammers@cu-online.com Proxeiro Script gia na ka8arizete ta Core arxeia. Otto Hammersmith, Dhmioyrghste ena arxeio me onoma rmcores (o syggrafeas to apokalei handle-cores) poy na periexei ton parakatw kwdika: ______________________________________________________________________ #!/bin/sh USAGE="$0 " 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 ______________________________________________________________________ Dhmioyrghste mia ergasia cron na to trexei periodika. 2.6. Metaferontas katalogoys metaju susthma arxeiwns. Alan Cox, A.Cox@swansea.ac.uk Grhgoros tropos na metaferete ena oloklhro dendro arxeiwn apo ena disko se enan allo (cd /source/directory && tar cf - . ) | (cd /dest/directory && tar xvfp -) [ AAllajte apo to /source/directory. Kante tar....klp. wste na apofugete thn pi8anothta na axrhsteusete to directory se periptwsh katastrofhs. Eyxaristw ton Jim Dennis, jadestar@rahul.net, poy moy to eipe. -Synt. ] 2.7. mghazey@miso.lowdown.com Breite toys megaluteroys katalogoys poy exete. Mick Ghazey, Exete anarwth8ei pote poioi einai oi megaluteroi katalogoi ston ypologisth sas; Oriste pws 8a to ma8ete. du -S | sort -n 2.8. To Linux Gazette Doja kai times ston John Fisk, to dhmioyrgo toy Linux Gazette. Einai ena ejairetiko hlektroniko periodiko kai epipleon, einai DWREAN!!! Ti perissotero mporeite na zhthsete; Deite monoi sas: http://www.ssc.com/lg Epi thn eykairia, fainetai oti (1) to LG bgainei se mhniaia ekdosh, kai (2) den to synthrei pia o John Fisk , alla oi synergates ths SSC. 2.9. Ted Stern, stern@amath.washington.edu Deikths sto patch gia to GNU Make 3.70 gia na allajete th symperifora toy VPATH. Den jerw an exoyn polloi an8rwpoi ayto to problhma, alla yparxei ena "xarakthristiko" toy GNU make ekdosh 3.70 to opoio de moy aresei. Einai oti to VPATH symperiferetai perierga an dwsete to apolyto onoma arxeioy. Yparxei ena ejairetika plhres patch poy dior8wnei to problhma, to opoio mporeite na breite apo ton Paul D. Smith . Aytos stelnei thn tekmhriwsh kai to patch meta apo ka8e epanekdosh toy GNU make sto newsgroup gnu.utils.bug. Genika, efarmozw ayto to patch kai kanw jana compile to gmake se ka8e susthma poy exw prosbash. 2.10. Pws stamatw to susthma moy na kanei fsck se ka8e epanekkinhsh; Dale Lutz, dal@wimsey.com Q: Pws stamatw to e2fsck na elegxei to disko moy ka8e fora poy kanw boot. A: Otan janaxtisete ton pyrhna, to susthma arxeiwn markaretai san 'brwmiko' kai etsi o diskos sas 8a elegxetai se ka8e ekkinhsh. Gia na to ftiajete ayto trejte to: rdev -R /zImage 1 Ayto dior8wnei ton pyrhna apo to na pisteuei oti to susthma arxeiwn einai brwmiko. Shmeiwsh: An xrhsimopoieite lilo, tote pros8este to read-only sthn egkatastash toy sto arxeio ru8mishs toy lilo (synh8ws sto /etc/lilo.conf) 2.11. Pws na apofugete ta fscks poy prokalountai apo "device busy" thn wra ths epanekkinhshs. Jon Tombs, jon@gtex02.us.es An blepete syxna la8h device busy kata to shutdown poy kanoyn to susthma arxeiwn na xreiazetai fsck kata thn epanekkinhsh, oriste mia mikrh dior8wsh : Pros8este thn parakatw grammh sto /etc/rc.d/init.d/halt h /etc/rc.d/rc.0 mount -o remount,ro /mount.dir gia ola ta prosarthmena (mounted) systhmata arxeiwn ektos toy /, prin thn klhsh umount -a. Ayto shmainei oti an, gia kapoio logo, to shut­ down apotuxei na skotwsei oles tis diergasies kai apoprosarthsei toys diskoys 8a einai akomh ka8aroi sthn epanekkinhsh. Etsi ejoikonomw polu xrono sthn epanekkinhsh. 2.12. Pws na breite ta megalutera arxeia sto disko sas. Simon Amor, simon@foobar.co.uk ls -l | sort +4n H, gi' aytous poy einai pragmatika scrunched gia xwro, mporei na argei ligo alla doyleuei mia xara: cd / ls -lR | sort +4n 2.13. Pws na typwsete selides kai na afhsete peri8wrio gia to diako­ reyth. Mike Dickey, mdickey@thorplus.lib.purdue.edu ______________________________________________________________________ #!/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, rockwell@nova.umd.edu Enas tropos gia na caxnete mesa se dendra arxeiwn gia mia sygkekrimenh kanonikh ekfrash. Onomazw ayto to script 'forall'. Xrhsimopoihste to ws ejhs : forall /usr/include grep -i ioctl forall /usr/man grep ioctl Na to 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, tolnas@nestor.engr.utk.edu Ena script gia na ka8arizei ta arxeia autosave kai backup poy dhmioyrgoun diafora pro­ grammata. Ena aplo programma duo-grammwn poy katebainei anadromika thn ierarxia enos katalogoy afairwntas ta arxeia emacs auto-save (#) kai backup (~), ta arxeia .o , kai ta TeX .log. Epishs sympiezei ta arxeia .tex kai ta README. To exw onomasei 'squeeze' sto susthma moy. ______________________________________________________________________ #!/bin/sh #SQUEEZE removes unnecessary files and compresses .tex and README files #By Barry tolnas, tolnas@sun1.engr.utk.edu # 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. simon@foobar.co.uk Pws na breite poia diergasia apaitei thn perissoterh mnhmh. Simon Amor, ps -aux | sort +4n -H- ps -aux | sort +5n 2.17. Ejopliste to vi gia programmatismo se C , Paul Anderson, Tips- HOWTO Synthrhths Exw programmatisei polu se C ston eleu8ero moy xrono, kai edwsa xrono gia na ejoplisw to vi wste na einai filiko me th C. Oriste to arxeio moy .exrc: ______________________________________________________________________ set autoindent set shiftwidth=4 set backspace=2 set ruler ______________________________________________________________________ Ti kanei ayto; To autoindent anagkazei to vi na kanei indent aytomata ka8e grammh poy akoloy8ei thn prwth poy egine indent, to shiftwidth 8etei thn apostash toy ^T (tab) se 4 kena, to backspace 8etei to backspace mode, kai to ruler deixnei ton ari8mo grammhs. Na 8ymaste, oti gia na pate se ena sygkekrimeno ari8mo grammhs, as poume thn 20, xrhsimopoihste to: ______________________________________________________________________ vi +20 myfile.c ______________________________________________________________________ 2.18. paul@geeky1.ebtech.net Giati to sendmail kollaei epi 5 lepta kata thn ekkinhsh sto RedHat; Paul Anderson, Ayto einai ena sxedon koino problhma, se shmeio na ginei FAQ. Den jerw an to RedHat dior8wse ayto to bug sth dianomh toys, alla mporeite na to dior8wsete kai monoi sas. An koitajete sto arxeio /etc/hosts , 8a deite oti moiazei kapws san : 127.0.0.1 localhost yourbox Otan jekina to sendmail, caxnei sto hostname poy exete (se ayth thn periptwsh, to yourbox). Ekei briskei oti to IP toy yourbox einai 127.0.0.1, ayto den aresei sto sendmail, kai caxnei pali. Synexizei me ayto gia ligo mexris otoy na egkataleicei kai na stamathsei. To na dior8wsete ayto to problhma einai polu aplo, anoijte to arxeio /etc/hosts kai allajte to se kati san to: 127.0.0.1 localhost 10.56.142.1 yourbox 2.19. Pws ry8mizw to RedHat gia na xrhsimopoiei thn color-ls; Paul Anderson, paul@geeky1.ebtech.net H dianomh RedHat erxetai me color-ls, parolayta den jerw giati den th ry8mizoyn gia xrhsh me xrwmata. Na pws 8a to dior8wsete. Prwta, gracte eval `DIRCOLORS` Meta, alias ls='ls --color=yes' Kai pros8este to 'alias.....' sto arxeio /etc/bashrc 2.20. vps@unicorn.niimm.spb.su Pws briskw poia biblio8hkh sto /usr/lib exei mia sygkekrimenh synarthsh; Pawel Veselow, Ti kanete an kanete compile kai de kanate link mia biblio8hkh poy xreiazetai; Ola ta gcc reports einai onomata synarthsewn... Na mia entolh deigma poy 8a brei ayto poy caxnete: for i in *; do echo $i:;nm $i|grep tgetnum 2>/dev/null;done opoy tgetnum einai to onoma ths synarthshs poy caxnete. 3. Leptomereis Ypodeijeis 3.1. Moirazontas ta swap partitions metaju Linux kai Windows. Tony Acero, ace3@midway.uchicago.edu 1. Formarete to partition san dos partition, kai dhmioyrghste to arxeio swap twn Windows se ayto, alla mhn trejete akomh ta windows. (8elete na krathsete to arxeio swap teleiws keno gia thn wra, wste na sympiestei kala). 2. 3ekinhste linux kai swste to partition se ena arxeio. Gia paradeigma an to partition htan to /dev/hda8: dd if=/dev/hda8 of=/etc/dosswap 3. Sympieste to arxeio swap toy dos. Mia kai einai sxedon ola 0 8a sympiestei polu kala gzip -9 /etc/dosswap 4. Pros8este to parakatw sto arxeio /etc/rc gia na proetoimasete kai na sthsete to swap xwro katw apo Linux: XXXXX einai o ari8mos twn mploks toy swap partition mkswap /dev/hda8 XXXXX swapon -av Sigoyreyteite oti pros8esate mia grammh gia to swap partition sto arx­ eio /etc/fstab 5. An to paketo sas init/reboot yposthrizei /etc/brc h /sbin/brc pros8este ta parakatw sto /etc/brc, alliws kante to me to xeri otan 8elete na jekinhsete se dos|os/2 kai 8elete na metatrecete to swap partition pisw sthn ekdosh gia 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 >> Poia einai ta pleonekthmata kai ta meionekthmata gia to parapanw; Pleonekthma: ejoikonomeite oysiastiko xwro apo to disko sas. Meionekthma: an to bhma 5 de ginetai aytomata, prepei na 8ymh8eite na to kanete me to xeri, kai epibarunei th diadikasia ekkinhshs kata ena nanosecond :-) 3.2. Apelpismena Undelete. Michael Hamilton, michael@actrix.gen.nz Na ena tryk poy eprepe na xrhsimopoihsw merikes fores. undelete arxeioy keimenoy gia apelpismenoys. An kata la8os sbhsate ena text arxeio, gia paradeigma, kapoio email, h ta apotelesmata mias olonuxtias programmatistikhs synedrias , mporei na mh xa8hkan ola. An to arxeio poy ftiajate sto disko, htan ekei p.x gia perissotero apo 30 deyterolepta, mporei ta periexomena toy na briskontai akomh sthn katatmhsh toy diskoy. Mporeite na xrhsimopoihsete thn entolh grep gia na cajei to raw disk partition gia ta periexomena toy arxeioy. Gia paradeigma, prosfata, esbhsa kata la8os ena kommati enos email. Etsi, stamathsa amesws opoiadhpote energeia poy mporouse na metaballei to partition: se ayth thn periptwsh apla apefyga na apo8hkeusw arxeia h na kanw metaglwttish (compile) klp. Se alles periptwseis, mphka pragmatika ston kopo na katebasw to susthma se single user mode, kai na apodesmeusw (unmount) to susthma arxeiwn. Xrhsimopoihsa tote thn entolh egrep sto partition toy diskoy: sthn periptwsh moy to email mhnyma htan sto /usr/local/home/michael/, etsi apo to output toy df, eida oti hmoyn sto /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 Twra eimai yperbolika prosektikos otan paizw me tis katatmhseis twn diskwn, etsi stamathsa na bebaiw8w oti katalabainw th suntajh ths entolhs PRIN na pathsw to plhktro return. Se ayth thn periptwsh to email perieixe th lejh 'ftp' akoloy8oumenh apo kapoio text poy to akoloy8ouse to 'COL'. To mhnyma htan peripoy 20 grammes, etsi xrhsimopoihsa to -50 gia na ferw oles tis lejeis gurw apo th frash. Sto parel8on eixa xrhsimopoihsei to -3000 gia na eimai sigoyros oti 8a parw oles tis grammes apo kapoio phgaio kwdika. Kateu8yna thn ejodo ths egrep se ena diaforetiko partition diskoy- etsi apefyga na gracw panw apo to palio mhnyma poy ecaxna. Meta xrhsimopoihsa thn entolh strings gia na me boh8hsei na ejetasw thn ejodo strings /tmp/x | less To email htan pragmatika ekei. Ayth h me8odos den einai gia na basisteite se ayth, olos, h meros, toy xwroy toy diskoy mporei na exei hdh janaxrhsimopoih8ei. Ayto to tryk einai pi8ana xrhsimo mono se systhmata poy doyleuei enas xrhsths. Se systhmata pollaplwn xrhstwn me ychlh drasthriothta diskoy, o xwros poy eley8erwsate mporei na exei hdh xrhsimopoih8ei. Akomh perissotero, den mporoume na trabame to xali katw apo toys xrhstes mas ka8e fora poy xreiazomaste na anakthsoyme ena arxeio. Sto susthma poy exw spiti, ayto to tryk fanhke boliko se treis peripoy periptwseis ta teleytaia xronia - synh8ws otan sbhnw tyxaia merikes meres doyleias. An o,ti doyleuw ftanei se ena shmeio opoy niw8w oti exw kanei shmantikh beltiwsh, kanw antigrafo asfaleias se ena floppy, etsi de xreiazomai ayto to tryk kai polu syxna. 3.3. Pws na xrhsimopoihsete to sta8ero flag. Jim Dennis, jadestar@rahul.net Xrhsimopoihsete to sta8ero Flag Amesws molis egkatasthsete kai ry8misete to susthma sas phgainete sta /bin, /sbin/, /usr/bin, /usr/sbin kai /usr/lib (kai merika of the other usual suspects kai kante gennaiodwrh xrhsh ths 'chattr +i entolhs'. Epishs pros8este ta arxeia toy pyrhna sto root. Kante 'mkdir /etc/.dist/' antigracte ta ola apo to /etc/ on down (ayto to kanw se duo bhmata xrhsimopoiwntas to /tmp/etcdist.tar gia na apofugw thn anadromh) se ekeino ton katalogo. (Proairetika mporeite na dhmioyrghsete to /etc/.dist.tar.gz) -- kai na to markarete sa sta8ero. O logos gia ola ayta einai na elattwsoyme th zhmia poy mporei na prokalesete an mpeite san root. De 8a gracete panw apo arxeia me ena telesth anakateu8ynshs (redirection operator) stray, kai de 8a kanete to susthma axrhsto me ena stray keno se mia entolh 'rm -fr' (mporeite akomh na kanete polles zhmies sta dedomena sas -- alla oi biblio8hkes kai ta ektelesima 8a einai pio asfalh. Ayto epishs kanei ena plh8os problhmatwn asfaleias kai arnhshs ejyphrethshs (denial of service) eite adunato eite pio duskolo na dhmioyrgh8oun (mia kai polloi basizontai sto na gracoyn panw apo ena arxeio mesw twn leitoyrgiwn kapoioy programmatos SUID poy *den parexei mia ay8aireth grammh entolwn*). O monos mpelas se ayto einai otan xtizete ton pyrhna kai kanete 'make install' se diafora eidh ektelesimwn toy systhmatos. Apo thn allh, empodizei epishs to 'make install' na grafei panw apo ta arxeia. Otan jexasete na diabasete to Makefile kai na kanete chattr -i ta arxeia poy prokeitai na graftoun apo panw (kai oi katalogoi stoys opoioys 8elete na pros8esete arxeia) -- to make apotygxanei, xrhsimopoieite apla thn entolh chattr kai to janatrexete. Mporeite epishs na arpajete ayth thn eykairia gia na metaferete ta palia sas bin's, lib's, h otidhpote se ena katalogo .old/ h na toy allajete onoma h na ta kanete tar h oti allo. 3.4. Jim Dennis, jadestar@rahul.net Mia protash gia to pou na topo8ethsete nea arxeia. Ola ta nea arxeia mpainoyn katw apo to /usr/local! h /usr/local/`hostname` An h dianomh sas afhnei to /usr/local adeio tote dhmioyrghste to /usr/local/src, /usr/local/bin klp. kai xrhsimopoihste ta. An h dianomh sas egka8ista programmata sto dendro /usr/local tote mporei na 8elete na kanete 'mkdir /usr/local/`hostname`' kai na dwsete to 'wheel' group +w se ayto (to kanw epishs SUID kai SGID gia na ejasfalisw oti ka8e melos toy wheel group mporei na anakateuetai me ta dika toy arxeia apo ekei kai katw, kai oti ola ta arxeia poy dhmioyrgh8hkan 8a anhkoyn sto 'wheel' group. Twra pei8arxhste ton eayto sas kai *PANTA! PANTA! PANTA!* balte ta nea paketa katw apo to /usr/local/src/.from/$OPOY_TA_EBA¨A/ (gia ta .tar h opoiadhpote arxeia) kai xtiste ta katw apo to /usr/local/src (h .../$HOSTNAME/src). Sigoyreyteite oti egka8istatai katw apo thn topikh ierarxia. An *prepei ypoxrewtika* na egkatasta8ei pisw sto /bin h /usr/bin h kapoy allou -- balte ena symlink apo thn topikh ierarxia se ka8e stoixeio toy apo na to balete opoydhpote allou. O logos gi' ayto -- akomh ki an apaitei perissoterh doyleia -- einai oti boh8a na apomonwsete o,ti prepei na ginei antigrafo asfaleias kai restore h na janaegkatasth8ei se periptwsh plhroys epanegkatastashs apo ta distribution media (synh8ws CD stis meres mas). Xrhsimopoiwntas to /usr/local/.from directory mporeite na krathsete ena anepishmo hmerologio (log) apo poy proerxontai oi phgaioi kwdikes -- to opoio boh8aei otan caxnete gia nees anaba8miseis -- kai mporei na einai polu apofasistiko otan kanete monitore tis listes anakoinwsewn sxetika me asfaleia. E-na apo ta systhmata moy sto spiti (ayto apo to opoio me to opoio kanw kai tis syndeseis moy) synarmologh8hke prin na yio8ethsw ayth thn taktikh gia ton eayto moy. Akomh de "gnwrizw" oles tis diafores apo to susthma poy afhnetai "opws egkatasta8hke". Ayto einai para to gegonos oti exw kanei polu liges ry8miseis sto susthma toy spitiou moy kai eimai to *mono* atomo poy to xrhsimopoiei. Anti8eta, ta systhmata poy exw sthsei sth doyleia (otan apekthsa ekei to rolo toy diaxeiristh systhmatos) exoyn ola ry8mistei me ayton ton tropo -- exoyn diaxeiristei apo pollous anadoxoys kai alloys an8rwpoys toy MIS, kai ekanan ena megalo ari8mo anaba8misewn kai egkatastasewn paketwn. Exw mia polu kalh idea gia to poia akribh stoixeia topo8eth8hkan sto susthma *meta* thn arxikh egkatastash kai ru8mish. 3.5. Metatrecte ola ta onomata twn arxeiwn enos katalogoy se mikra grammata. Justin Dossey, dossey@ou.edu Parathrhsa merikes yperbolika duskoles h mh aparaithtes diadikasies poy proteinontai sto tmhma 2c tips toy teuxoys 12. Mia kai einai perissoteres apo mia, tis stelnw se sena: ______________________________________________________________________ #!/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 ______________________________________________________________________ Wp, ayto einai megalo script. De 8a egrafa tetoio script gia na kanw ayto. Anti8eta, 8a xrhsimopoiousa ayth thn entolh: for i in * ; do [ -f $i ] && mv -i $i `echo $i | tr '[A-Z]' '[a-z]'`; done; sth grammh entolwn. O an8rwpos poy ekane ayth th syneisfora, leei oti egrace to script me ayto ton tropo wste na einai katanohto (deite parakatw). Sthn epomenh ypodeijh, ayth sxetika me thn pros8hkh kai diagrafh xrhstwn, o Geoff ta paei mia xara mexri to teleytaio bhma. Epanekkinhsh; Wx, elpizw na mh xreiazetai epanekkinhsh toy systhmatos ka8e fora poy diagrafei ena xrhsth. O,ti xreiazetai na kanete einai ta duo prwta bhmata. Ti eidoys diergasies 8a exei afhsei o xrhsths, allwste; Ena irc bot; Skotwste tis diadikasies apla me thn kill -9 `ps -aux |grep ^ |tr -s " " |cut -d " " -f2` Paradeigma, to username einai foo kill -9 `ps -aux |grep ^foo |tr -s " " |cut -d " " -f2` Twra poy frontisame ki ayto, as proxwrhsoyme sto jexasmeno kwdiko toy root. H lush poy dinetai sto Gazette einai h pio koinh, alla oxi kai h pio eukolh. Me to LILO kai to loadlin, mporeite na dwsete thn parametro gia boot se periballon enos xrhsth (single) gia aytomath ekkinhsh sto proka8orismeno shell xwris login h password prompt. Apo ekei, mporeite na allajete h na afairesete passwords prin na gracete "init 3" na jekinhsete se katastash pollaplwn xrhstwn (multiuser mode). Ari8mos Epanekkinhsewn: 1 Me ton allo tropo Ari8mos Epanekkinhsewn: 2 Justin Dossey 3.6. Jim Dennis, jadestar@rahul.net Merikes ypodeijeis gia neoys sysadmins. Dhmioyrghste kai synthrhste ena /README.`hostname` kai/h ena /etc/README.`hostname` [H pi8ana /usr/local/etc/README.`hostname` -Maint. ] Opwsdhpote, krathste shmeiwseis apo *thn prwth mera* ths diaxeirishs toy systhmatos se ena online log arxeio. Mporeite na ftiajete ena vi /README.$(hostname). Mia grammh sto arxeio toy root /bash_logout. Enas allos tropos na to kanete ayto einai na gracete su h ena sudo script poy kanei kati san to parakatw: 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 - (xrhsimopoihste thn entolh typescript gia na dhmioyrghste ena session log kai dhmioyrghste mia synarthsh poy 8a pros8etei kai 8a enhmerwnei aytomata to log). Paradexomai oti den exw ylopoihsei ayto thn politikh aytomaths enhmerwshs -- exw basistei ws twra sthn aytopei8arxia moy ws twra. Parolayta, exw paijei me ayth thn idea (mexri to shmeio na ftiajw ena protypo deigma (prototype) twn scripts kai twn shell synarthsewn opws tis blepete). Ena pragma poy me krataei einai h idia h 'script' entolh. Nomizw oti 8a prepei na parw ton kwdika kai na pros8esw dyo parametroys sth grammh entolwn (gia na diakoptw/stamatw to script na katagrafei apo th grammh entolwn) prin na desmeytw oti 8a to xrhsimopoiw). H teleytaia moy protash (gi' ayto to guro): To path toy Root 8a prepei na periexei to 'PATH= /bin' Ayta kai tipota allo sto path toy root. O,ti kanei o root parexetai apo ena symlink apo to /bin h apo ena alias h shell roytina, h einai ena script h ena ektelesimo sto /bin, h grafetai me to plhres path. Ayto kanei ton ka8ena poy trexei san root na gnwrizei (merikes fores epwdyna) poso empisteuetai ta ektelesima. O gnwstikos admin enos host pollwn xrhstwn 8a koitaei periodika mesw toy dikou toy /bin kai twn arxeiwn /.*history caxnontas patterns kai para8yra. O pragmatika drasthriopoihmenos admin 8a entopisei akoloy8ies poy mporoun na aytomatopoih8oun, merh sta opoia elegxoi mporoun/prepei na eisax8oun , kai diadikasies gia tis opoies "root" ta dikaiwmata 8a prepei na apofeyx8oun proswrina (h ektelesh diaforwn epejergastwn, MTA's kai alla megala dialogika (interactive) programmata me periploka xarakthristika scripting ta opoia *mporei* na enswmatw8oun se diafanh arxeia h arxeia dedomenwn -- opws to aisxro vi ./.exrc kai to emacs ./.emacs kai to akomh perissotero upoylo $EXINIT kai oi enswmatwmenes makroentoles epikefalidwn (header/footer macros)). Fysiologika oi entoles aytou toy tupoy mporoun na trejoyn me kati san: cp $data $some_users_home/tmp su -c $origcommand $whatever_switches cp $some_users_home/tmp $data (...opoy oi leptomereies ejartwntai apo thn entolh). Aytes oi teleytaies kyriws profylajeis yperbolikes gia to spiti h to "single" sta8mo ergasias toy xrhsth -- alla einai polu kalh taktikh gia th diaxeirish enos systhmatos pollaplwn xrhstwn -- eidika gia ena susthma dhmosia ekte8eimeno (opws ayto sto netcom). 3.7. Pws na ry8misete to xdm's chooser gia epilogh host. Arrigo Tri­ ulzi, a.triulzi@ic.ac.uk 1. Enhmerwste to arxeio poy fortwnei to xdm polu pi8ana to /etc/rc/rc.6 h /etc/rc.local) etsi wste na periexei tis parakatw grammes sto tmhma ekkinhshs toy xdm. /usr/bin/X11/xdm exec /usr/bin/X11/X -indirect hostname 2. Anoijte to /usr/lib/X11/xdm/Xservers kai balte se sxolia th grammh poy jekina to server sto topiko mhxanhma (p.x. jekinwntas me 0:) 3. Epanekkinhste to mhxanhma kai you're home and away. Ayto to pros8esa otan prospa8ousa apegnwsmena na to egkatasthsw gia to diko moy subnet edw xreiasthke peripoy mia bdomada gia na kateynasw ola ta problhmata. Proeidopoihsh: me to palio SLS (1.1.1) gia kapoio logo mporeite na afhste ena -nodaemon meta th grammh xdm -- ayto DE doyleuei gia metagenesteres ekdoseis. 3.8. Peri ths Ellhnikhs Metafrashs Gia sxolia, parathrhseis, dior8wseis, enhmerwseis peri ths Ellhnikhs metafrashs aytou toy HOWTO, steilte email sthn Boula Sanida : voulariba@hellug.gr h ston Eyripidh Papakwsta : evris@hellug.gr kai enallaktika : ep@rocketmail.com