H9, H10 & H11Samenvatting door Margreet T. |
|
man commando, bv man ls: formated and displayed manual page man man voor meer uitleg boek noemt 2 opties -k toont ook wat verwant is <=> apropos -f alle pagina's die voldoen <=> whatis Ze staan (.gz) in /usr/share/man/man1 of ander nr. Je hebt dus nr's voor de verschillende groepen, niet elk commando komt in elk nr voor 1 programma's, opdrachten 2 system calls (ioctl, reboot) 3 library calls (zlib, killchar) 4 speciale bestanden (die in /dev (bv null, random)) 5 bestandsformaten en conventies (afspraken, wat doe je zie ook man 5 passwd) 6 spellen (fortune, xboard) 7 macropakketten en conventies (grof, man maar ook sql zoals fetch, close) 8 systeembeheersopdrachten (mount, mkfs) 9 kernelroutines (bij mij staat er niets in) Je vraagt andere secties op met bv: man 5 passwd Wat vind je in een manpage:
zcat manpage.1.gz | nroff -mandoc | less Verdere documentatie volgens het boek in: /usr/doc niet op mijn systeem wel /usr/share/doc doc's over apps
Voor de rest:
Documentatie:
Gebruikersondersteuning Geef elke call een eigen nummer
Voorbeelden van proggies voor helpdeskadministratie:
H 10 beheer gebruikersbeheer gebruikers doe je als root, je kunt wel als mortal user een aantal zaken lezen (/etc/passwd) [mtielf@mercurius mtielf]$ cat /etc/passwd root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin Velden 1 login kleine letters 2 passwd of x 3 UID 4 GID 5 naam gebruiker of commentaar 6 logindirectory (meestal /home) 7 shell versleutelde wachtwoord zit in /etc/shadow [root@mercurius mtielf]# ls -l /usr/bin/passwd -r-s--x--x 1 root root 89273 Feb 15 2004 /usr/bin/passwd het passwd commando heeft het SUID-bit , zodoende [root@mercurius mtielf]# ls -l /etc/passwd -rw-r--r-- 1 root root 1784 Oct 3 15:12 /etc/passwd [root@mercurius mtielf]# ls -l /etc/shadow -r-------- 1 root root 1277 Nov 20 09:40 /etc/shadow [root@mercurius mtielf]# ls -l /usr/bin/passwd -r-s--x--x 1 root root 89273 Feb 15 2004 /usr/bin/passwd [root@mercurius mtielf]# grep marc /etc/shadow marc:$1$F1YS2Qll$h1MJtJWKh9H9luaGMSxM50:12742:0:99999:7::: [root@mercurius mtielf]# passwd marc Changing password for user marc. New password: Retype new password: passwd: all authentication tokens updated successfully. [root@mercurius mtielf]# grep marc /etc/shadow marc:$1$sRdmTehE$5Ofl4WUJ.Fo2426ISYi1V/:12742:0:99999:7::: [root@mercurius mtielf]# De velden in /etc/shadow
De laatste 2 zijn bij mij leeg /etc/group [root@mercurius mtielf]# cat /etc/group root:x:0:root bin:x:1:root,bin,daemon daemon:x:2:root,bin,daemon sys:x:3:root,bin,adm adm:x:4:root,adm,daemon en daarbij ook weer een gshadow [root@mercurius mtielf]# cat /etc/gshadow root:::root bin:::root,bin,daemon daemon:::root,bin,daemon
/etc/skel is een directory waarin alle dingen staan die een nieuw aangemaakte gebruiker krijgt bij mij leeg in de /etc/default staan de standaardinstellingen voor bepaalde programma's, bv useradd: [root@mercurius skel]# cat /etc/default/useradd # useradd defaults file GROUP=100 HOME=/home INACTIVE=-1 EXPIRE= SHELL=/bin/bash SKEL=/etc/skel passwd is het commando om passwd te wijzigen, als gebruiker moet je eerst het oude invoeren. Je kunt als root ook passwd gebruiken om de rechten van mensen in te perken :-) [root@mercurius /]# passwd -x 45 -n 15 -w 7 -i 10 marc Adjusting aging data for user marc. passwd: Success [root@mercurius /]# grep marc /etc/shadow marc:$1$sRdmTehE$5Ofl4WUJ.Fo2426ISYi1V/:12742:15:45:7:10:: [root@mercurius /]# je kunt met de optie -l (lock) en -u (unlock) nog meer macht uitoefenen [root@mercurius /]# passwd -l marc Locking password for user marc. passwd: Success [root@mercurius /]# grep marc /etc/shadow marc:!!$1$sRdmTehE$5Ofl4WUJ.Fo2426ISYi1V/:12742:15:45:7:10:: [root@mercurius /]# passwd -u marc Unlocking password for user marc. passwd: Success. [root@mercurius /]# grep marc /etc/shadow marc:$1$sRdmTehE$5Ofl4WUJ.Fo2426ISYi1V/:12742:15:45:7:10:: [root@mercurius /]# het commando chage geeft je als mortal user info: [mtielf@mercurius mtielf]$ chage -l mtielf Minimum: 0 Maximum: 99999 Warning: 7 Inactive: -1 Last Change: Aug 27, 2003 Password Expires: Never Password Inactive: Never Account Expires: Never Als root kun je van alles instellen net zoals met passwd chage [-m mindays] [-M maxdays] [-d lastday] [-I inactive] [-E expiredate] [-W warndays] user gebruik van -E (expire) [root@mercurius mtielf]# chage -E 2004/11/30 marc [root@mercurius mtielf]# chage -l marc Minimum: 15 Maximum: 45 Warning: 7 Inactive: 10 Last Change: Nov 20, 2004 Password Expires: Jan 04, 2005 Password Inactive: Jan 14, 2005 Account Expires: Nov 30, 2004 [root@mercurius mtielf]# useradd useradd [-c comment] [-d home_dir] [-e expire_date] [-f inactive_time] [-g initial_group] [-G group[,...]] [-m [-k skeleton_dir] | -M] [-n] [-o] [-p passwd] [-r] [-s shell] [-u uid] login gewoonlijk met -m (dan gaat alles van de /etc/skel in de homedir) zie de manpage :-) user verwijderen: userdel met optie -r (recursief, dus alles) Groepen moet je aanmaken groupadd bla -g uniek getal van GID -o niet uniek getal groupdel bla als je van meer dan een groep lid bent en je wilt dat je bestanden die je maakt de groepsnaam van de "andere" groep krijgen doe je dat met newgrp groepsnaam [root@mercurius root]# gpasswd marc Changing the password for group marc New Password: Re-enter new password: opties: -a voeg gebruiker toe aan groep [root@mercurius root]# gpasswd -a mtielf marc Adding user mtielf to group marc [root@mercurius root]# -A groepsbeheerders -M leden -r verwijderd groepsww (door root) id [root@mercurius root]# id uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel) Aanpassen van gegevens: je hebt in het algemeen de /etc/profile, in je eigen dir de .bash_profile, volgens boek .profile Mijn /etc/profile is veel minder lang dan in het boek, begint met PATH veel is in het boek het instellen van kleurtjes en aliassen, lijkt me niet nodig .... in de /etc/skel kun je bv de bookmarks van je browser plaatsen (van je bedrijf of zo) 1. useradd -m cursus3 2. passwd -l cursus3 3. groupad groep gpasswd -a cursus cursus3 groep gpasswd -A cursus 1. A 2. C 3. E H. 11 systeembeheer/etc/syslog.conf beschrijft waar wat gelogd wordt Nov 20 10:54:51 mercurius sshd(pam_unix)[3630]: session opened for user marc by (uid=502) Nov 20 10:57:24 mercurius su(pam_unix)[3460]: session closed for user root Nov 20 10:57:29 mercurius su(pam_unix)[3412]: session closed for user root Nov 20 10:58:54 mercurius su(pam_unix)[3707]: session opened for user root by mtielf(uid=500) Nov 20 11:03:23 mercurius su(pam_unix)[3837]: session opened for user root by mtielf(uid=500) Nov 20 11:04:42 mercurius sshd(pam_unix)[3630]: session closed for user marc [root@mercurius mtielf]# dag tijd hostname programma wat syslogd is de daemon afzenders (processen) worden facilities genoemd auth authpriv cron daemon kern etc......zie boek priorities: van debug, info, ........, panic in de /etc/syslog.conf staat wat waar wordt gelogd[ Taken automatisch laten uitvoeren via at (eenmalig) en cron [mtielf@mercurius mtielf]$ at now at> ls -l at> > EOT < job 1 at 2004-11-20 11:43 resultaat wordt gemaild at [-V] [-q queue] [-f file] [-mldbv] TIME at -c job [job...] atq [-V] [-q queue] atrm [-V] job [job...] batch [-V] [-q queue] [-f file] [-mv] [TIME] opties: -f bestandje meegeven dat opdrachten bevat -q wachtrij tijden bv: 11:20 dec 5 jaartal: 120504 op zijn amerikaans at + 3 hours at 10 am tomorrow kortom, vrij veel manieren wachtrij at -q c now staat dus in wachtrij q: hoe hoger nr. hoe hoger nice-waarde Inhoud van een at-job in de wachtrij bevat een replica van de environment (LANG=dutch; export LANG) + opdrachten atq laat zien wat in de rij staat , je ziet rijnr. of = teken (wordt nu uitgevoerd) atrm remove batch is een soort at maar alleen als systeembelasting onder 0.8 is (of waarde in ATRUN) root mag altijd at gebruiken anderen volgens /etc/at.allow en /etc/at.deny cron: leuk mechanisme om dagelijkse taken uit te voeren velden: minuten, uren, dag van de maand, maand, dag van de week (1 is maandag0 meer aangeven met komma's bv op de 1e en 15e van de maand 1,15 of 0-9/2 is 0,2,4,6,8, wijzigen met crontab -e allow zelfde idee: /var/cron/allow en /var/cron/deny BACK-UPS wordt te vaak vergeten :-( cpio CoPy Input/Outpout Copy out find . -print | cpio -ov >archief.cpio Copy in cat archief.cpio | cpio -iv Pass trough find /home/mtielf -print | -pv /home/marc test mode cat archief.cpio | cpio -it (geeft inhoud) tar tar -cvf archief.tar (pakt in) tar -xvf archief.tar (pakt uit) tar -tvf archief.tar (test) met z gzippen Linux® is the registered trademark of Linux Torvalds in the U.S. and other countries. |