Book - « – .. LINUX ., - . # 2005 . , .!. " »...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: « – .. LINUX ., - . # 2005 . , .!. " » $% 661.3.066 & % 32.973.26 & : '( " ) +. ., - -) ( ., . * .–" . ( ) *( - "( . ., - . .. .& ' ( .-" . , .# - ) : . .& ! !" " Linux: /, 2005. 93 . ( / . .& .# : ISBN " " "( " ( "( ) * '" " * " * * * ( *" 075200 - % " "( "( * "0 " " " . * ) ", ) "- Linux. " ". $ " EXT2FS EXT3FS, * "( ,") " ( ". ) " " " , * " "" " Linux. * * " "" * – (", 075600 0 * 1 * ". ( " , , ) , 075500 - % " " $% 661.3.066 & % 32.973.26 & ISBN « . .& , 2005 * . - », 2005 # .......................................................................................................... 4 5 ' ! .................................................................. ! 6 2. ' 6#..7 ..................................................................................................... 14 2.1. . " ........................................... 18 .................................................................. 18 ) .............................................................. 19 ................................................................................... 20 " /proc................................................................................ 21 0 " ............................................... 22 EXT3FS............................................. 26 ........................................................... 41 8 . ./#97 ................................ 50 " .......................................... 50 4.2. 9 " ................................................................ 53 4.3. % .................................................................................... 56 ...................................................... 58 ................................................................................................ 59 2!& ' !/ ' 78 ' !%/ % 9 .................................................................... 61 #$# 1. 23 4 !/#2 " *" 0 2.2. / 2.3. % ( " 2.4. " 2.5. * 2.6. 4 3. !82 ( "" " 7# . ./#97 EXT2FS 3.1. 4. ' !& /! . & :#%/!9 4.1. ' !82 " " 4.4. " 4.5. * ;1« < " *» ...................................................................................................... 2 * ; 2 «$ " EXT2FS» .............................................................................................................. 2 * ;3 « "" " " . Linux» ............................................................................................... 2 * ; 4 «! " . Linux» ........................ 2 2 * ;5 « 63 67 72 75 ' 2 =# # 1. % ' 2 =# # 2. . 80 ................................................................................ & . Linux» ............. 85 " Linux ....................... 86 DebugFS...................................... 90 ( " ( UNIX " ( "" " 0 *" )")* * " UNIX Windows. ( 1. . 0 , Microsoft, "0 ( " UNIX/Linux * "" 2. . UNIX , . ( 1 ( ", *" "* ( " " " " " 0 - 1 ( * ) " *". .. ". < *""" - , -* " " " .5 ( * 1 " " , ": * * ( "" "0 1 - * UNIX 1 0 " *0 , , "- ( * 1 "0 " . " -, ( " * *" * ": *, *. / " " ,1 " "" 0 * * ( 0 ) "( . 3. < , " * ,* * * ". 1" " * " , " , < "0 ( " *, " .> " *) " < ", * " . 4. ( " UNIX "" " * "" , " " " " "0 "" . UNIX " . )* , "0 * *, " " * (" Windows*. / , " * " *" ", "0 "( ", )* "* ", 0" "* , " *) * ( .. ( " UNIX * *) ""( ) .& * ) "0 ,1 " " 4 * , , 0 .. " * * Web," ,1 " 0" . UNIX * 0 * ( " "" -* . (, ( " UNIX 0 *" *. ( * " ) *, ", " "( * ( -" ( .! " " "0 " " ( . " * " ( "0 (" " -. 1" " . UNIX * ". "* * ) " UNIX, Linux " 0 *– 2 / . * 1 " ** * *" "" , "0 . " , , * "* 1 "" . *" ( ) 0 ** " " ".> "" , , Linux ) ) ( ", * ( "( . " * * * " " "0 ( ", "" "" . ( " Linux * * *", ") "( * Linux *) "* *) * " " .# 1 * - ", " " * ) Linux . '" ) ( " * " *: < ( ), ( < ( * " ). "" " ** * ") 1 " " ". $ 0 , 0" .%" * , ) . UNIX : 5 1. %0 " " ( * (UID – User ID). " "0 "( , 216 = 65536 * *( )" * " – ( " : daemon, bin, sys, nobody ., " ( ". ( " " * " " 1 " 0" . UID = 0 "* root * * * * " " "). 9 0 " ", 0 " " .% * , root – 1 * " " .. ) , " 0* * " "" * * " " ". . , " " "0 * " " , * " " " .! " 0 , " *" "0 * ", Linux ** * " « ", 1 " " : .$ * . " ( " " ( " "( "0 " *, 1 * * .. ** " " 90 * 0" - , , **. ?». rm –rf /home/user1/file1 > " . " rm –rf / home/user1/file1 " . 0 "0 " / " , < , * " , $* *" - " * ( " * . . * " " Linux " " "0 * * * * *" 0 " " 6 0 * GID (Group ID). , " * groupadd ( 1. 1 man ommand_name). – 216 = 65536. 0 0 "0 . * $* ( ) ( . * " : "* " , "1 " " . useradd ( " « » /etc/shadow "0 " * 1-" ! *, 1 ( " " *) ", * /etc, 1 ." * * *** "* * , * " , , * * *" . * " ".> »: " « (- 1" " " 0". * 1". " " "" . /etc/passwd * * * (, 0* , *) 7 : *, *, " ( *, " " " , "* " 7 - "0 . Linux "" *) " "0 *" group, passwd shadow, , *) " * ( ". /etc/group. 0 " *). # ** * - " * " . " * "* , * 0. 0 .# , * *0 * ". [ – *, " * ". ) " ./ *, " " Linux ") 1 " passwd, * " .( adduser * "" , * * " 0 *0 " <Enter>. , 0 " * <Enter>. adduser . " ( " " " , * ( " , * , "* " - ( * . - ) * * *( * * , * "* , ( ( *. , . - root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin sync:x:5:0:sync:/sbin:/bin/sync shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt mail:x:8:12:mail:/var/spool/mail:/sbin/nologin news:x:9:13:news:/etc/news: uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin operator:x:11:0:operator:/root:/sbin/nologin games:x:12:100:games:/usr/games:/sbin/nologin gopher:x:13:30:gopher:/var/gopher:/sbin/nologin ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin nobody:x:99:99:Nobody:/:/sbin/nologin vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin rpm:x:37:37::/var/lib/rpm:/bin/bash xfs:x:43:43:X Font Server:/etc/X11/fs:/sbin/nologin rpc:x:32:32:Portmapper RPC user:/:/sbin/nologin mailnull:x:47:47::/var/spool/mqueue:/sbin/nologin smmsp:x:51:51::/var/spool/mqueue:/sbin/nologin gdm:x:42:42::/var/gdm:/sbin/nologin nscd:x:28:28:NSCD Daemon:/:/sbin/nologin ntp:x:38:38::/etc/ntp:/sbin/nologin pcap:x:77:77::/var/arpwatch:/sbin/nologin 1. . 2 ." /etc/passwd * *. # * " ,1 * " - /etc/shadow. * (, 0 * *" : * *, 1*" 1/etc/shadow 9 , ( "* , 1" " " " " 1.01.70 . *, " " * " * * * *, * , *, " . , - *, " * * * *. 8 - *, 0 * " , , /etc/passwd 0" * root:$1$Yj7IcY8O$oCX9V9QYipDtYflbfOOBE1:12496:0:99999:7::: bin:*:12495:0:99999:7::: daemon:*:12495:0:99999:7::: adm:*:12495:0:99999:7::: lp:*:12495:0:99999:7::: sync:*:12495:0:99999:7::: shutdown:*:12495:0:99999:7::: halt:*:12495:0:99999:7::: mail:*:12495:0:99999:7::: news:*:12495:0:99999:7::: uucp:*:12495:0:99999:7::: operator:*:12495:0:99999:7::: games:*:12495:0:99999:7::: gopher:*:12495:0:99999:7::: ftp:*:12495:0:99999:7::: nobody:*:12495:0:99999:7::: vcsa:!!:12495:0:99999:7::: rpm:!!:12495:0:99999:7::: xfs:!!:12495:0:99999:7::: rpc:!!:12495:0:99999:7::: mailnull:!!:12495:0:99999:7::: smmsp:!!:12495:0:99999:7::: gdm:!!:12495:0:99999:7::: nscd:!!:12495:0:99999:7::: ntp:!!:12495:0:99999:7::: pcap:!!:12495:0:99999:7::: 2. . 2 /etc/shadow 0" " . passwd, ( " " *. ") 0 " * , * * " " " , /etc/shadow, " root. / *" " SUID, " 0. * , " ** * # 0* -" * $*" ( ) ) " usermod, *" 0 " * (, 9 " "0 *) * " " ). Passwd – 1 ", ** " 1 "" passwd . ", , 0 " - " "" . "0 " " useradd. . . userdel %" * * 0 " (: userdel user_name * , " 0 ( -r * *. " ) " " )" < ". (r – read), (w – write) (x – execute). * : "0 * * , *" * " " ) " " " , * , 0 "( ") " " * r - x = 101 - w x = 011 r - - = 100 . * > =5 =3 =4 * " < " : 0- * ( . , " *, * , * " ( . - * < ). ' ls (list 5 15. *0 * ". - . - ( "" . . 0 " " ( ". " *1 ( " " - * " ( ": - ** " , ** $* *, * ( . - " < .$ " . ) .. ") ,"0 " mkdir ( -m, ". ": mkdir –m 1555 /home/user1 . , ", ") * ". $ * " ls –l) , "0 "0 –1 ** * 10 " "( "0 " *. ( " ( < -" " * .& " " "" " , 90 *" "0 ") «" . " *– " " » ", ( ) 0 ). 1" *" , * * " –0 " , 0666 – * umask = 022 0" umask * " ( 0 )" " 1 ") " .& " , "0 , ", " 0 - "" " *") " umask. 1 ") *" .4 " * 0777 * *" *" . ", * *" 755 (111 101 101 = rwxr-xr-x). / ) * . ) *1 " " " " "0 ) * "0 * ) *– 1 " , * . " . - " 0 " " ". 0 "). " * - " "0 " * .! " " , – chmod (change mode – " , " "0 * "– - chmod XXXX file_name ( " *. 0" " (, * " 1 , . * * 1" ( , * "– " . 0" " "" , " " ) ( UID ( , , ( * , "0 " * * ") " , * " ( , chmod 077 file_name " " * ", " * )* , ( , " * ". . * * (UID), .! ", " UID , 0, ).# ,– ** * " . ," 0 0– * (" " " chmod. " " 0 " . chown (change owner – " ( ). chown user file_name – " 11 (. *" *" "( "0 "" *", , . * , " 1 - , " " " ), Linux . "0 * * *. . "0 0 < . " * ( ", " <- 1" " "0 " " - ** "0 .> * ") : chattr +(-) option file_name – " . ( "0 : i– " , – (, " * , – " 0 " / , s– . 4 "+" , "-" . *1 0 * " . 1" " "0 , " ( " " UNIX). ", +i, " "0 , , " .> " " " " " * *" . $ " ls * *, * * " *" lsattr file_name. " " " ( * ", 1 " (* , " *, 0 *. $ * 1 " "0 * * , " . " "0 ") " su (substitute user *). # " " su "" *, * "" , *. $ * " ", " " " su " , root. , " 0 * " *–1 * * , )* "" ". ", su, * " "" " " * . 12 " " su "- *" .# "" su " ** * " , 0 " - root. , *" " *1 !$ * " * )* .> * 0 " *" , , 0 1 * " , , * root. " . " " " 0 * ** " " , 1 " *. . , 0 ) " " * ", * "" ) sudo . 0 13 " * * * "" " *" /etc/sudoers, . 1" " * , " * * sudo ( " * * 1 " . " ) ". "" " 0 *. (, " ( " , (, 0 , " " " " 0 - " * " " < 1 $ – * " - " " sudo, "* * 2. UNIX * * *" " "" ) *, ( " *" * " " " "( ./ , "" " " * ( , " " * " -* «0 » ( , ( ) ** " "( 0 . ( –1 "" 1 *. ( –1 , , " ( * " * "" . % 1 * "* *"* , 0 * "" , ( "), (, " * " ( *. . 0 * "" " 0 " *" ( . *) * 0 "" 0 "0 " ( . 1" ( " . ( "0 " ". ( "0 * * ( " . UNIX" ) ( , )* *" , 0 " " * " 0 ) < ". 1. . " ( . " *" * * ( " .. " ( ( " * * . * " ( " )" " .> ( ) * ", "0 0 " * ( .. , , ** * " " ", " *0 *1 " ( ", *" . # (, ** * " ", * *, *" " " init. > ( ** * " ( . 2. $ " .> ( , 0 ) * " *" " * * ". * * " 0" : , " " . 0" " *" , * " , ". 3. ( .4 * *" ( ) ". " ** " " 0" * 0 *. ( *, ," ) <( " 14 ". " ( , - ." "" " – 0. 0 ) – ( 0" " ". % " " , 0 ( . * * . " " ( ( " .%0 " ( 0 ", ) " " " ( .2 ", ) , . ( *» ( ) *( * 1 ( ) "* ( 0 * " ( * . ( 0" * * 0 0 * " " * , ** " * ) , "( " -" ( " ) " " 0". , - "" , - "0 0" * ( - * , *" " ( .& , ( " " ** < .# ** "" 0 " 0" "" , * * * * ," " ) " (scheduler). " UNIX ", * ) *) " ,)" (, « ) ( .$ * ,0 * "* . 5-7% ( " , ) , () .% " , " * - " " ) * " ( 0 " 0" * " " " "0 (( " 0". .) " * ». " , "* ( - « ( ( 0" * , * " ( ". 0" : ( "0 ( * ( " , ( . ( - 1" * Nice Number, " ) . . - ( " 15 " ( –1 < " - ( " *- . *. 1 " " " , , ( , ( " , " – 0 . %0 " " ", " ( " ( %1 " .) ", ), * * " – 1 ( , " ," 0 "* ( "" " 0 "" , " ( ", * " * . " " " )* -* «0 " - ( " - (. ) " . - " *"0 0 1 ( " ( . "* ( 0 ", . 0 (* 1" " *" . " "- 0 *" " * * " * . " 1 . "0 , * " , , ( - * , 0 ( *) , " <" » ) ( " * "0 [2,5]. "", " ( ," 0 ( . «= *» "* - ". - ( "" ". ** * ( .%0 " " 16 * (process identifier – PID). / " ", " "0 " ) " – 65536 ( . ( " * ( " *, " *. * *" * "" ( " " ", * ". ( " 0 . ( UNUX « " 0 *» " *. $ * 1 ) ( 0 « », * " ," " fork ( – ). ** 1 , " ( ,* * ) * , ") PID *) * " " .$ ( * ( Parent Process ID (PPID). «' »" " " " ,) . " ( " *) – UID, " *, . "0 " " < " ,1 16 "" . " , , . ", , ( ls –la /root ( " 0" " , ) “permission denied”. "" (, ) " *. 0 (, ) " root, . *" " " 1 * EUID. " " 0 " SUID ( ". 3). > * ( * * " *, (, " ( . ", *" *" ( " " * *) ). (, "0 . $* * " ( " 0 " ps (process status). 3 0 ( , " –el. ( * –e 0 ( ,l– -( ) . S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S R S S R UID 0 0 0 0 0 0 0 0 0 0 0 32 0 51 0 0 0 43 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 "" -" PID PPID C PRI NI 1 2 3 8 4 5 10 19 71 647 651 663 768 777 787 796 807 889 898 912 917 918 968 981 997 1008 1010 1012 1017 1090 1091 1092 1129 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 912 918 968 981 1 1 1 749 1 1090 1090 1092 3. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 24 24 5 14 24 24 14 24 14 24 24 24 24 14 24 24 24 24 0 24 17 17 19 24 24 24 24 24 24 23 16 24 24 " 0 0 19 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 19 0 0 0 0 0 0 0 0 0 0 0 0 0 0 TIME CMD 00:00:04 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:01 00:00:00 00:00:00 00:00:00 ( init [keventd] [ksoftirqd_CPU0] [bdflush] [kswapd] [kscand/DMA] [mdrecoveryd] [kjournald] [khubd] syslogd -m 0 klogd -x [portmap] [sendmail] [sendmail] gpm -t imps2 -m /dev/psaux crond cupsd [xfs] anacron -s login -- root /sbin/mingetty tty6 /bin/sh /usr/X11R6/bin/startx xinit /etc/X11/xinit/xinitrc -/usr/bin/gnome-session ssh-agent /etc/X11/xinit/Xclients /usr/libexec/gconfd-2 11 /usr/libexec/bonobo-activation-server -gnome-settings-daemon --oaf-activate-iid [fam] gnome-terminal [gnome-pty-helpe] bash ps -eo s,uid,pid,ppid,c,pri,ni,time,cmd ( 17 , " " ps. ." *: S– /– R– "S SW – ( ( - ( * PID, PPID ) " " UID 0 " ( , TIME – "" ". . (CMD " (. ( ) 2.1. ! " # ) - * , * ( *, * 0 " 0 .9 ( - *, . "* "* ! " % &' ( $ . " " ( PRI NI * ( ( "" ), "! " * " "( (" "* , *" ( " .> " * * " (signals), ) *" (messages), " (pipes), " " (semaphores) *" "* .4 " "* " " . * " *"0 ( "*) * * " .. –1 " , "* ( .% 1 0* ", * *" kill ( – ). $ , ) ** ( , -*. . * "" ( Linux" ) * ). $ * 0 "" " * ( , *) , 0 ( " . $* * 9.>. " " -* "" " " signignore, * * , "" .. kill -9 PID * (, ) , 1"« » ( "0 . "0 " ( ", " .! " " (.$*« » ( , "" , 0 * " * *, * 0 * " killall. ( " 2.2. . *. " ' ! UNIX /) "0 18 (- ( " " "( *, 1 ), "0 * * ". " "( "0 " ). " 1 "* , * "* ( 1 0 " (* "0 ". " * "* - * . ": ls –la /home/user1 > /etc/syslog.ls $ .# 0 * 1 " * , ) 0" *. # *. , ) logger >> /etc/syslog.ls . 1" .# "* ) , " ""0 * " "( (1" ** * ). 0"" " - " " ( "* - - " (* " " " , " cat file_name > /dev/fd0 ? " " . " cat file_name > /dev/lp0 " , 0" . " " - "( , * " "0 " "0 . " cat /usr/share/sndconfig/sample.au > /dev/audio . " ! " ** "0 * .%" " ./ , " ( , , *" "" 2.3. * % ") )( UNIX * * "0 ! " * )) ) , * "* ) * * , 19 ( –1 ". ", : . - * " * * * , "0 " .% "0 ( ". " " " * " . *" - ./ , <", 0 " |. " " * 1 " ls –la /bin|more. % "0 - .% " * « » 1" *( " ", " more 1 » ( 0 ls –la /bin|less * , " " "0 1 . #) " * 0" - " « " . * * : * cat file_name|wc cat " file_name * "" wc, , , "- 0 20 ps –ef | head -20 ps 1 ( ( (, , head dd if=/dev/fd0 | grep “Linux” dd “Linux”. % 0 ,, ") " ) " ) , .? (. grep ) " ," ( " *. 2.4. " 1" 0 ) " , ) " "*( *– ) "* , 1 – , .4 " " " FIFO (First-In, First-Out – " -, "" 0 * (. *" mkfifo, ": " ) " " " 0 ). % 0" " " mkfifo /tmp/fifo1 " ( ) " " 20 tmp. 2 , * .% .$ * 1 " " ! * " " .4 " * " " 1 "0 " 0 , 0, 1 . 2.5. + # "* /proc. " " Linux " /proc (process). / " * ", * " ( "( . 1 , 1 " " " « ,1 "* * * " ", * * * ) , - , " *) " 0 * " * * " "* " " "* /proc " .% " * )"* ( , " *" ( PID. * * *, 0 » 0* < " " ," , " 0 ) .> .9 ps), " /proc *" , , < " " * * " ", ". " " /proc $! /proc * 1 ", < " "( . ) -" " cat < /tmp/fifo1. cat > /tmp/fifo1. , - <Enter> , * . * *" " , * " "0 " . * 0 " "( ( ( 0 ) – . 0" ( . 1). < (1 /proc / . "$«, # » ' /proc/PID cmdline cwd « 0" » %! " . " " " . , " " -* " "" ). . «, # » ( * 0- " ( , " - * " , " ( 21 , - .1 0 environ * (USER, HOME, PATH .). > * * " " ". *" ( , 0) , " ( ". % 0 * –1 " * . *" , 0 "* ( "* ( ( ( /) * ( "" " * "* ( .. 0 7 , " .> : ) " ( 9 " ( " " " "* " " " 0 < " "* " ( ( "* * ( , "* *. 0 ( , ( , 1 *, * "* , ), ( " *, * *. " " . % exe fd maps mem root stat statm . . . status • • • • • • • . " 0 " 0 * * * 1 " " ". ", /proc/tty/driver/serial. ) "( , 0" 2.6. "" * * ) " " ! " " %! " ( * < - "( . ( .% " "0 1" , " ", " * ' & ' - "" ! 0 1" 0" " 0 ) 0" . " 22 " . * , " " ) " 0 , - "" , * " ) * " " * " " , * " (Shell). " **" ,1 " * ". *) " ** * - ", "* " 0 " *" ( *. *" * : /bin /sbin, * ( "0 , * . " "0 , * *"" , * "" " . 0 "" "" " " * 0 * PATH ( – 0, ). "/din, /sbin, /usr/bin, /usr/local/bin, ". $ * " 1" 0 ) , " «.», 1 ( . "0 * " 0" " , 1" ,") Born shell (/bin/sh), C shell (/bin/csh), Korn shell (/bin/ksh), Bash (/bin/bash). , , " 0 Midnight Commander. ( , " " 0 Gnom KDE. *" 0 * : •" " " , • ( , • . ( * " * "" . " * " " .% ( * " 0" " . ( " < * *. / , 0 " ** *1 ": ps –e –l –f = ps –elf " -) < " . /, .) " CNU Coding Standarts * * * * "" * Linux. / , " () ," " , " " “h” (help) – $ ( * , 0 ./ " , "" 0 0 " ( 0 "* ) "" , * * : (. 0 "* "" " «l» (long) « » (all) – 0 " ( . , . "* "* " (. ) "" dd - " . - dd if = /dev/fd0 of = /mnt/floppy/fda count = 10 skip = 1 conv = noerror,sync 23 ( %" " " 0" . * - «;», ", * " * " " * 0" " . "0 * ) ( . ) *. ( " " -* " &( 1" " . ( " "0 . "0 - , " ": ), * * " - ** " " clear; pwd; date # " "( " " " .# , grep , – 0 " &&, ") * 0, ") " – *. * * , : - "- grep “ivanow” /etc/passwd && grep “ivanow” /etc/group ' - " - || . *, " ": ls –l /root || ls –l /home # 1 *" ,.. " .. " ) 0"* " 0 tory – 1" " * , " " " - . "0 ," 0 « » ( ./ 0 " "0 * 1000 " ). > * " . * ) " ") " ( ** " . mc mount dd if=/dev/hda6 of=/tmp/bootsect.lnx bs=1 count=512 mc lilo cnfig mount /dev/hda1 -vfat /mnt/hda1 dd if=/dev/fd0 of=/tmp/bootsect.lnx bs=1 count=512 umount /mnt/floppy mc 24 " " " 0 0 , his- "- " passwd dd if=/dev/fd0 of=floppy1 count=2800 conv=noerror,sync fdisk -l /dev/hda6 ls -li / lde -i 131329 /dev/hda6 mc lde -b 0x00040203 /dev/hda6|more mc debugfs /dev/hda6 cd /home ls cd /etc ls -li debugfs -R stats /dev/hda6 2 4. " * " * 25 " history 3. + / * " ( * " "* ", " " / " " , ) . " ". " $ *, ) " 4096 " , ). " : " * " " - MS DOS, * . Windows* " * » ) * ," «" "( " "0 0 " ** " (*" 0 .& , " " * "* ( " " ( Linux " * * , " 4% , , 0 * * " 26 * " - , " * file, " "» " " .& * **" 1024, ." " . * " UNIX " "* , " *) ./ " * ( % , "0 " " Linux * *, - " "« - * ( ( . , * , .$* ( . Windows* . * "* * < - , " *, ""0 (512 " " " 0", 0 * 0 1" *" ". " EXT2FS EXT3FS (. " " * 1 " *. "< "* * * . "( "0 ( ". 7 ( , , , , - * 2048 )) .. " ** EXT3FS ( . " * EXT2FS " - " , ( 4 % ). * - . Linux " . ")- " * . " ( " 5), , * "( ") *" ) " ls –li /, " , 131329 328321 196993 164161 525313 541729 558145 11 230275 590977 607393 1 180577 640225 213409 229825 32833 drwxr-xr-x drwxr-xr-x drwxr-xr-x drwxr-xr-x drwxr-xr-x drwxr-xr-x drwxr-xr-x drwx-----drwxr-xr-x drwxr-xr-x drwxr-xr-x dr-xr-xr-x drwxr-x--drwxr-xr-x drwxrwxrwt drwxr-xr-x drwxr-xr-x 2 4 20 55 2 2 9 2 2 5 2 69 17 2 9 15 17 5. 2 root root root root root root root root root root root root root root root root root -4% , 0 18 18 30 30 30 29 18 18 29 18 29 30 30 18 30 18 18 17:42 15:18 10:41 10:47 11:42 2003 17:50 17:22 2003 14:06 2003 2004 11:25 17:54 11:24 17:30 17:36 < ". 2 * , /proc, " " .# " ** , * *) ( " ) " /sbin "* ) . " *" " : 16 % – 0 0 " ,* * * " " - .& 0. * "), - ", - " &' 1 ' 1 - &0 ! (Linux Loader) &' 1 ' 2 ' . 1. & bin boot dev etc home initrd lib lost+foun misc mnt opt proc root sbin tmp usr var " Linux " *1 /lost+found ( 4096 4096 118784 4096 4096 4096 4096 16384 4096 4096 4096 0 4096 8192 4096 4096 4096 " (* " .% root root root root root root root root root root root root root root root root root " .> . " . " 0 < * Linux " * " * . 27 &' 1 ' N ……. " , * (. - " "0 "0 ** , )). " 1 0 . (( 1024 LILO (Linux Loader), .%0 * . 2. " 0 - " - 1)* ( " Linux " " 1. " - ") 1& " .# . & & / * * ( ' . 2. . . " 1024 * " 0 " .$ " " ** , 2 ./ " 0 "* " " ( *, " " ," " 0* . * 0 "* , * * 0 * " "( -* * * 4& ) <* * * * ". * *" . 0 * ") ) , . * " ( mount – 1" * ** " , <" " (* ", * * "* " * , *) * .> * ", " ( . " * , * " *. . " ) ( . 2.): 28 – 1" ( " . 1 " 80 * - ( . " - " - (2 / . 4 0 4 4h 4 8h 4 4 4 Ch 10h 14h 4 18h 4 1Ch 4 4 4 20h 24h 28h 4 2Ch ! 4 30h ! ( ) , - , 1=2 ;2=4 :0=1 . 2 34h 2 36h 2 38h 2 3Ah ' 2 3Ch 2 4 3Eh 40h 4 44h ' ( ) ! & 4 48h 4Ch 50h 1970 ") ( " .# , ! ) 6 ; ) * 4 944 1) ( ) 1 (0 , . % "& " (0xEF53), . $ " , , ex2fs " , ext3fs , - " " , - 1024 , * Linux Disk Editor ( . 2). "( " 29 0x00000400 0x00000410 0x00000420 0x00000430 0x00000440 0 00 D8 00 4A 73 1 07 31 80 FA 94 23 0E 0C 00 68 59 00 00 00 40 40 4 00 00 00 0B 00 5 00 00 80 00 4E 6. . 2 6 1C 00 00 27 ED 7 00 00 00 00 00 : : : : : 8 6F 02 20 53 00 9ABC DE 66 00 40 EF 00 01 00 00 01 00 00 00 00 00 00 F0 02 4A 01 01 47 00 FA 00 00 13 00 68 00 00 ........of...G.. .1.............. ........ @..J.h@ J.h@..'.S....... s.Y@.N.......... 80 (50h) 0" , " (.@ F 00 00 40 00 00 ( - " " " ). / , - " (.. " * " * " ( 1 : , * " (inode). ! 919296 bc), * " " "* *, 00 0# 07 00h. " *" - " 00 1. 00 00h = 1835008, . . 2 8 &( , , ? ") * ( inode). $* " 1666Fh = 91759 . " " . 0 * , .> 10% 1347F0h = 1263600 4935,93 9 '" 1000h = 4096 . 0 – 8000h = 32768 4020h = 16416 ./ " ", * 0 , ""0 " 16416 0 * "0 65534 ) . ", " )" " 0 (Group Descriptors) " " 32 * " ) : - 128 9 .'32768, . 0 4 4h 4 8h 2 Ch + + + , , . 30 (3 * bitmap) , (inode table) - " / 4 * - (inode bitmap) " (block " - .3 , 2 Eh 2 10h 14 12h , " ) " ( *, , . 0x00001000 0x00001010 0 1 23 , "* 4 5 6 7 0 8 - * ( 9A BCDE F 02 00 00 00 03 00 00 00 : 04 00 00 00 09 1A 14 40 02 00 00 00 00 00 00 00 : 00 00 00 00 00 00 00 00 2 7. $ " ...............@ ................ * "2 ( - "0 (. " ( ". (00 00 00 02h), 7), * * 3 (00 00 00 03h). / 4 (00 00 00 04h). 16404 (4014h) 0 "( * " 2 * ) 6665 (1A09h) , " . " " , . . ") . 2) " 0 * " debugfs ( " " .$ *1 " : debugfs –R stats device " device /dev/hda7, " ext2fs Filesystem volume name: Last mounted on: Filesystem UUID: Filesystem magic number: Filesystem revision #: Filesystem features: sparse_super Default mount options: Filesystem state: Errors behavior: Filesystem OS type: Inode count: Block count: 0 Ural <not available> e21e03f0-78d6-11d8-8d23-e14cf2ed36f3 0xEF53 1 (dynamic) has_journal filetype needs_recovery 31 - * , (none) clean Continue Linux 919296 1835008 , " "( * " - " - Reserved block count: 91759 Free blocks: 1263777 Free inodes: 799179 First block: 0 Block size: 4096 Fragment size: 4096 Blocks per group: 32768 Fragments per group: 32768 Inodes per group: 16416 Inode blocks per group: 513 Filesystem created: Thu Mar 18 17:22:11 2004 Last mount time: Wed Mar 31 10:51:19 2004 Last write time: Wed Mar 31 10:51:19 2004 Mount count: 12 Maximum mount count: 39 ‘ Last checked: Thu Mar 18 17:22:11 2004 Check interval: 15552000 (6 months) Next check after: Tue Sep 14 18:22:11 2004 Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 128 Journal UUID: <none> Journal inode: 8 Journal device: 0x0000 First orphan inode: 215730 ‘ « » Directories: 6542 Group 0: block bitmap at 2, inode bitmap at 3, inode table at 4 6907 free blocks, 16404 free inodes, 2 used directories Group 1: block bitmap at 32770, inode bitmap at 32771, inode table at 32772 21539 free blocks, 13804 free inodes, 87 used directories Group 2: block bitmap at 65536, inode bitmap at 65537, inode table at 65538 23284 free blocks, 14394 free inodes, 158 used directories Group 3: block bitmap at 98306, inode bitmap at 98307, inode table at 98308 23711 free blocks, 14240 free inodes, 190 used directories Group 4: block bitmap at 131072, inode bitmap at 131073, inode table at 131074 23287 free blocks, 14918 free inodes, 116 used directories Group 5: block bitmap at 163842, inode bitmap at 163843, inode table at 163844 22903 free blocks, 14532 free inodes, 84 used directories 8. 2 Debugfs ") * , ", 0 " - "(* Lde. ( & * " * ", " " 0- , " " * * * , " " " ( ,"0 . , " * "0 . (block bitmap) - 1 . * .# 1, .> 0 * 32 ,1 , 0" " * "- - *, " 21111 1111 ( . 0x00002460 0x00002470 0x00002480 0x00002490 0x000024A0 0x000024B0 0x000024C0 0x000024D0 0x000024E0 0x000024F0 0x00002500 0x00002510 0x00002520 0x00002530 " . (block bitmap). & FF ). . " ) * 24CCh FF, , , 0- * , FF FF FF FF FF FF FF 00 00 00 00 00 00 00 FF FF FF FF FF FF FF 00 00 00 00 00 00 00 FF FF FF FF FF FF FF 00 00 00 00 00 00 00 FF FF FF FF FF FF FF 00 00 00 00 00 00 00 FF FF FF FF FF FF FF 00 00 00 00 00 00 00 FF FF FF FF FF FF FF 00 00 00 00 00 00 00 9. 2 " * 1 " "( & * * ( inode. " 10. 4 0x000037B0 0x000037C0 0x000037D0 0x000037E0 0x000037F0 0x00003800 0x00003810 0x00003820 0x00003830 0x00003840 0x00003850 2 . 00 00 00 00 00 00 FF FF FF FF FF FF FF FF FF FF FF FF 00 00 00 00 00 00 00 FF FF FF FF FF FF FF 00 00 00 00 00 00 00 : : : : : : : : : : : : : : 3F FF FF FF FF FF FF 00 00 00 00 00 00 00 FC FF FF FF FF FF FF 00 00 00 00 00 00 00 3F FF FF FF FF FF FF 00 00 00 00 00 00 00 F0 FF FF FF FF FF 0F 00 00 00 00 00 00 00 FF FF FF FF FF FF 00 00 00 00 00 00 00 00 10. 00 00 00 00 00 FF FF FF FF FF FF , , * 00 00 00 00 00 FF FF FF FF FF FF - " "- FF FF FF FF FF FF 00 00 00 00 00 00 00 00 FF FF FF FF FF FF 00 00 00 00 00 00 00 00 " ". ........?.?..... ................ ................ ................ ................ ................ ................ ................ ................ ................ ................ ................ ................ ................ 00 00 00 00 00 FF FF FF FF FF FF 00 00 00 00 00 FF FF FF FF FF FF : : : : : : : : : : : 00 00 00 00 00 FF FF FF FF FF FF " - * 0. " " 00 00 00 00 00 FF FF FF FF FF FF , * * "( " 128* 00 00 00 00 00 00 FF FF FF FF FF * ) " : 00 00 00 00 00 00 FF FF FF FF FF –1 " - " * block bitmap, " 0 . ", " * . ", " , 00 00 00 00 00 00 FF FF FF FF FF FF FF FF FF FF FF 00 00 00 00 00 00 00 00 * 00 00 00 00 00 FF FF FF FF FF FF 00 00 00 00 00 FF FF FF FF FF FF , " : . * 00 00 00 00 00 FF FF FF FF FF FF " 00 00 00 00 00 FF FF FF FF FF FF 00 00 00 00 00 FF FF FF FF FF FF 00 00 00 00 00 FF FF FF FF FF FF - ................ ................ ................ ................ ................ ................ ................ ................ ................ ................ ................ . " )* 0 ( , * * - * - .% 0 " ( 33 * " " "- " . " , 0 " 4", 16416 8), " ** . ") : " " , " * 32 ./ " *) * ( ". * 513 ./ * " EXT2FS, , " " * " EXT3FS, " ( *, "* " debugfs, . 0 " " EXT3FS " 0 inode ( ") *0 (, * 8192 ./ " ", ( * 4- , 8195. " < " 128 ) (4 / . - ' 2 2 4 4 4 4 4 2 2 4 4 4 0 2h 4h 8h Ch 10h 14h 18h 1Ah 1Ch 20h 24h 15 4 28h 4 4 4 4 1 1 2 42 64h 68h 6Ch 70h 74h 75h 76h 78h / " . UID / ! ! ! ! . - GID (« 512 , ' ) * ,- » , ! ACL ACL + ( NFS) / ) ) ( "0 lde –b block_numder device. * 0 80h inode ) * 128 , ") 80h. 34 , ") * " 11. ' " "0 "– 0x02003A00 0x02003A10 0x02003A20 0x02003A30 0x02003A40 0x02003A50 0x02003A60 0x02003A70 0x02003A80 0x02003A90 0x02003AA0 0x02003AB0 0x02003AC0 0x02003AD0 ED 0C 00 00 00 00 00 00 A4 12 00 00 00 00 41 96 00 00 00 00 00 00 81 6E 00 00 00 00 00 59 00 00 00 00 00 00 00 A8 00 00 00 00 00 40 00 00 00 00 00 00 00 3E 00 00 00 00 00 00 00 00 00 00 9C 00 37 00 00 00 00 00 11. 2 1 "," * 0 ( " . " .% "(* . "( 10 00 00 00 00 00 79 00 00 00 00 00 00 00 00 00 00 00 00 00 17 00 00 00 00 00 00 00 00 00 00 00 00 00 E5 00 00 00 00 00 00 00 : : : : : : : : : : : : : : DC 00 1B 00 00 00 00 00 1A 00 1C 00 00 00 " 09 00 82 00 00 00 00 00 96 00 82 00 00 00 69 02 06 00 00 00 00 00 59 01 06 00 00 00 40 00 00 00 00 00 00 00 40 00 00 00 00 00 0C 08 00 00 00 00 00 00 0C 08 00 00 00 00 96 00 00 00 00 00 00 00 96 00 00 00 00 00 59 00 00 00 00 00 00 00 59 00 00 00 00 00 40 00 00 00 00 00 00 00 40 00 00 00 00 00 .A........i..Y@ ..Y@............ ................ ................ ................ ................ .....y.......... ................ ....7.....Y@..Y@ .n.>............ ................ ................ ................ ................ ( * * " *1 ," 0 " " inode *" ( ( " " inode, *1 " debugfs. " . ( inode, " ( 0 , 0 "( . UNIX " 0 -" 0 "0 7 ( . 5. ) , . – - * . (5 / ( / @ % ." . " d l s f b c * " 4( )" $ ) ( 3 ( * * 0 * 12 0 ". $ * A 1 6 2 " *: SUID – 35 - 8 4 . *( * ", ** - *3 ". (1 , *) " " bit – *" " ), SGID – " * *" , (( ( , Sticky ," - *) ( , *) 0) ( * * , **) * ( " ). -* * : – , – , – .2 * – (, ** – , * – * . /, inode 11 ( 41 EDh. -( 4" * ", " – . * " ", * *** * : 1EDh = 0001 1110 1101b = 000 111 101 101. " "0 *. ? ": 1 . ( " , (" * *, 0" ( * ). . ) ** * " ( Owner UID. 1 , 1" ( * )" 0 65536. / " " " . 00 00h 0 " *, (" " * * *. . ) 0 "( " . 00 00 10 00h = 4096 " " <" . ? * 4 0" 0 " " : ) *, *, " (, *. ' ", " " "* *, , – ( , * inode "* ) .% 0, 0 * " inode, " "( , . –1 " («0 » ) . *, 0) " " , 0 , -1* * 1970 .? 1 "* , 0 * , " "*. * * " -36 *( "0 ( Perl. * " " * , ( " * ! 11. *, 000 110 100 100 1 ( (" " * inode, 0 ) " "0 1 ( *, "* *, ( ) *. 00 00h – 1 root ( " ). (00 02h). % " 8 512 " 4096 .$ ) .# , ( *" 0 "" " ", " * " 00 06 82 1Bh. " " , ( *( 81!4h , 1 * " ( * 1 4h = 0001 1010 0100b = " "( : , " * , " , * * * root – " . " 37h = 55 . "( , 0( . * " "( " , *1 " lde. 0 " * /bin. - 0 , " *" " lde –i 131329 /dev/hda5 INODE: 131329 (0x00020101) drwxr-xr-x 0 0 2004 TYPE: directory LINKS: 2 MODEFLAGS.MODE: 004.0755 SIZE: 4096 BLOCK COUNT: 8 UID: 00000 GID: 00000 ACCESS TIME: Tue Mar 30 CREATION TIME: Thu Mar 18 MODIFICATION TIME: Thu Mar 18 DELETION TIME: Thu Jan 1 DIRECT BLOCKS: 0x00040203 4096 Thu Mar 18 17:42:58 11:46:37 17:42:58 17:42:58 05:00:00 2004 2004 2004 1970 INDIRECT BLOCK: DOUBLE INDIRECT BLOCK: TRIPLE INDIRECT BLOCK: 2 12. "(* inode /bin, 37 * " Lde " ) 0 * * ls –ali /bin. * ( 131329 drwxr-xr-x #) "* * "* , . 15 inode; " " 4 " ". . " ) " " 4 12 = 48 % . - " <" . " ) 256 (indirect block). # 4096 " ( 4 root " * " * * - 0 . 2 root " , * ls , "( 1 "0 1 " 1970 ", – " .# ) * *. -1 " inode * ( 12 " *" 4% " " ( 0 inode ") ") 12. - ) ( ** ( "0 * , " (direct blocks). " " ( - ** ( 256*4 + 48 = 1072 % , " * * 256 " " * " , " ( .# - * , " , " * 0 .# 18 17:42 . ( .> ( (double indirect block). (, 1 ") * , * * 256 " " ( (triply indirect block). " )" -* ) *" (( " *, 1" " ). (, " , , *. * 0 " 0. 13 inode " –( *. $ * 1 SUID, 0 , ) " , " 0 " / , 0 . " : chattr +ics file_name inode "0 . 1" 0 ) : 38 * ( ( " *. - * , * 0 ) 0 . "( INODE: 527744 (0x00080D80) -rwsr-xr-x 0 0 69 Sat Apr TYPE: regular file LINKS: 1 MODEFLAGS.MODE: 010.4755 SIZE: 69 BLOCK COUNT: 8 UID: 00000 GID: 00000 ACCESS TIME: Sat Apr 3 13:19:39 2004 CREATION TIME: Sat Apr 3 13:23:24 2004 MODIFICATION TIME: Sat Apr 3 13:19:39 2004 DELETION TIME: Thu Jan 1 05:00:00 1970 DIRECT BLOCKS: 0x001024F9 3 13:19:39 2004 INDIRECT BLOCK: DOUBLE INDIRECT BLOCK: TRIPLE INDIRECT BLOCK: 13. 2 0x024F9000 0x024F9010 0x024F9020 0x024F9030 0x024F9040 0x024F9050 0x024F9060 0x024F9070 0x024F9080 64 66 20 30 73 00 00 00 00 64 3D 73 30 79 00 00 00 00 20 2F 6B 20 6E 00 00 00 00 69 68 69 63 63 00 00 00 00 66 6F 70 6F 0A 00 00 00 00 3D 6D 3D 6E 00 00 00 00 00 " "*. " .! " " " 2F 65 32 76 00 00 00 00 00 64 2F 30 3D 00 00 00 00 00 : : : : : : : : : 65 66 20 6E 00 00 00 00 00 76 6C 63 6F 00 00 00 00 00 2F 6F 6F 65 00 00 00 00 00 66 70 75 72 00 00 00 00 00 14. & 2 " -( "(* , 0 ( 64 70 6E 72 00 00 00 00 00 30 79 74 6F 00 00 00 00 00 inode " 0 * "0 * ") 131329 2 131559 131542 131509 131333 131510 drwxr-xr-x drwxr-xr-x -rwxr-xr-x lrwxrwxrwx -rwxr-xr-x -rwxr-xr-x -rwxr-xr-x 2 19 1 1 1 1 1 root root root root root root root 15 *) , .' root root root root root root root 4096 4096 4594 4 15643 626028 19812 39 * dd if=/dev/fd0 o f=/home/floppy_a skip=20 count=1 00 conv=noerror, sync............ ................ ................ ................ ................ * * 65536 «0 "" * - 6F 61 31 2C 00 00 00 00 00 -( ") . 20 5F 3D 72 00 00 00 00 00 " » " ", " /bin. , 18 17:42 . 6 12:53 .. 25 2003 arch 18 17:29 awk -> gawk 4 2003 basename 26 2003 bash 4 2003 cat – , .. *- 131334 131512 131513 131514 131957 131515 131516 131517 131518 131560 131552 lrwxrwxrwx -rwxr-xr-x -rwxr-xr-x -rwxr-xr-x -rwxr-xr-x -rwxr-xr-x -rwxr-xr-x -rwxr-xr-x -rwxr-xr-x -rwxr-xr-x lrwxrwxrwx 1 1 1 1 1 1 1 1 1 1 1 15. 2 root root root root root root root root root root root root root root root root root root root root root root 4 23999 26124 57792 63871 26305 45838 35496 38648 6537 8 /bin, " 18 17:29 sh -> bash 4 2003 chmod 4 2003 chown 4 2003 cp 29 2003 cpio 4 2003 cut 4 2003 date 4 2003 dd 4 2003 df 25 2003 dmesg 18 17:30 dnsdomainname -> 0 /bin ( " "" ). $ "* .' .% "(* " , "* 5 1 " 1 . . . 4 01 0C 73 B5 39 6D 62 65 66 67 70 63 6F 10 10 0C 2 " 01 00 68 01 39 6B 61 67 67 72 30 61 6D 00 00 00 02 02 00 02 35 74 73 72 72 65 35 74 61 05 05 02 - ) 00 02 00 00 66 65 68 65 65 70 39 00 69 01 01 01 0C 2E 05 18 34 6D 32 70 70 B7 39 E0 6E 63 63 63 . 00 2E 01 00 34 70 00 00 00 01 35 01 6E 68 68 70 01 00 02 08 34 00 00 00 00 02 66 02 61 6D 6F 00 02 00 00 01 00 00 00 00 00 00 34 00 6D 6F 77 00 "* 1, , " : : : : : : : : : : : : : : : : 2E 06 0C 62 04 03 B2 B3 B4 14 B6 18 65 64 6E BB 00 01 00 61 01 01 01 01 01 00 01 00 66 00 00 01 00 02 04 73 02 02 02 02 02 05 02 0D 34 00 00 02 , 0) -2, " (. 16. $ " 16 "( , . – 7. ASCII*" 4- 0x40203000 0x40203010 0x40203020 0x40203030 0x40203040 0x40203050 0x40203060 0x40203070 0x40203080 0x40203090 0x402030A0 0x402030B0 0x402030C0 0x402030D0 0x402030E0 0x402030F0 " - . *( * "* "* " (" ) *, (, 0 * 0 * 2 , , (, " 0 " $ $ / , * ", , ( " " * ls –ali /bin " 00 00 01 65 00 00 00 00 00 01 00 07 00 00 00 00 02 0C 62 6E 10 10 10 10 0C 63 0C 64 B8 B9 BA 0C 00 00 61 61 00 00 00 00 00 68 00 6E 01 01 01 00 0) 00 02 73 6D 06 05 05 05 04 67 03 73 02 02 02 03 00 07 68 65 01 07 01 01 01 72 01 64 00 00 00 01 ................ ................ sh..........bash ........basename 995f444......... mktemp.......... bash2........... egrep........... fgrep........... grep........chgr p05995f4........ cat.........dnsd omainnamef4..... ....chmod....... ....chown....... ....cp.......... /bin /bin. *. " * 40 - " 4 " inode ./ 1 /bin. . "* " " 1 – - " ./ * , "- .? ** * 4- *" * , , 2E. 4- " 00 00 00 02h = 2, ** * " ( ) .$ 1 0 00 0Ch = 12 ./ – 02h – " " ( "* – ). ? 02h – ( ). "* – – " " 2E 2Eh. #) * 00 00h 1 . 00 02 01 06h = 131334, inode " sh " bash (11 15). "* 1 0 , - 0" * 12 ./ 02h * " ./ ( ) 07h, ". (, 68 73h * """ - sh. " , – , (. % 0 , ") * . , 1 , " * , ". * "0 ( ( 0 0 ( " ). 1 ", * ") *( " " , * ) , )* 0 * *", (. 4 " 2 (. * 00 02 01 01h = 131329, ) 00 0Ch = 12 0 01h = 1, * .$ , "* – 02h = 2, "* , * 3.1. " !& 9 UNIX 0 , " *" ./ " " , ** * * " .? ) 1 ", . ( " Linux * , * 1" " ", .! " " ", " "0 41 )2, # ( - 0 " * ( "( (- * *« " *, " ) 0 " » "( " . - 2 ) * * * , inode rm (remove). , ) * *( -r " " «Y» (Yes) " "0 " rm * *. " ") "« * " * , ( * "0 ( " . ( , * ) «! * ". - , " *" , 0 "0 UNIX ) "( 0 " "0 .$ * ) Sticky- , /tmp * " ( chmod 1777 0" T " : " , . " /tmp. " - 1 0 ./ , Sticky- . 0" " ls –l, " t ) . chmod 1776 /tmp, : drwxrwxrwT. : Sticky)* ( 1" * : drwxrwxrwt. ( 1"0 * , *. * /tmp * 0 –1 "" "0 1 * " *" " ) – » "- ) *. $ * ", " – " ( " - ) * ». , . , «Enter». " *" 1 ") –f ( " - .% " 1" , " " " * " . < " !" Linux " * (0 * , , " 0 ( . ( " " " * , *" " " *"" * " "( 42 " UNIX "- Windows* * .$ * * ( . shred – " , ). *( " - " Linux. " ( . " " " 128", " *. . " Linux 0 * " inode 0 " 0 shred 25 " " " 1" " . 1. ( ( ) "* - * " " " *" " " Linux *- **" * . , , : " – «0 » , . "( creat *" "* " " " .. " 0 """ * *1 " inode " . 0 * *( :0 " 0 " , inode * " . * ) : "(* ", " 0( " 0 ) "( ), inode " * " . * * " , 1" 0" " " . "1 0. * " ", , "0 , * " . *, -" " 0 , . * * " , 1 ", * 0 , * , " " " * inode. / " " "" " . 1 ", " " 0- * "" "( , ) ) -* ,) "( . ", ) * " " ". $ *1 "* ( 9.>. " " fillfile, * 0 ", * " "" "* "0 " ". ": " fillfile 600 b )" " "b < " " 600 , 0 " b. . " ) " " " " . 43 1. 2. 3. 4. 5. /home " fillfile 3000 a " " " 3000 ( ¾ " ) " " « », 1"0 " .$ ") " ls –li " ) , " « », "* ", " * 3000 , " inode. $ ", inode = 234567. . ") " lde –i 234567 /dev/hdc3 ( " /dev/hdc3 – Linux) " "( , 0) *1" " . " inode = 234567 *" , .$ ", "1 0x000167A8. 4 * " ") " lde –b 0x167A8 /dev/hdc3 1 0 ", ") * 3000 (BB8h) " " « ». " ") " rm –f a . " * inode " , 0 " *, * - .$ " *, -* inode, " (NOT USERS "* * ). . ") fillfile " “ b” " " 300 " " “ b” . " * /home ") " ls –ali /home, " " 0 " 1 . *, " " ", " ". % , inode * * 0 "( . **" inode “ b” , " 0 * 0 ", " * ") * “ a” . " 0" 1 * 0 ( ". /, * " * " Linux - 2.3 ) *. 300 " " ‘b” , " 212 ( ), -** " 3000 " " “ a” . % , " , * " "0 0 « " » 0 . " * " 2.4 «" »0 *: " ) , *" ". 9 "0 (, " Linux, * *. . , ) ), 0 inode " 0, *"0 * , " " . *" 0 ," * EXT3FS EXT2FS ( . . 0 ( ). " " 44 / " ", . 17 0x00100203, 0) " " Pr_Linux.doc. 0x00203000 0x00203010 0x00203020 0x00203030 0x00203040 0x00203050 0x00203060 0x00203070 0x00203080 01 20 50 14 67 6B 6C 72 6A 04 00 72 00 0D 5F 73 69 0D 17. 2 08 02 5F 09 08 6C 5F 73 08 00 02 4C 01 00 00 6C 5F 00 0C 2E 69 72 14 68 69 69 18 " " 0 00 2E 6E 69 00 0D 31 6E 00 01 00 75 73 0B 08 00 6F 0D ( 0 . * * 04 00 30 00 0D 5F 73 69 0D 18. ' " ' Pr_Linux.doc. & , *) 2E 65 2E 66 72 14 5A 65 72 00 0D 64 73 69 00 07 5F 69 00 08 6F 74 73 0A 08 62 73 08 02 30 09 08 6C 5F 73 08 00 02 30 01 00 00 6C 5F 00 0C 2E 30 72 14 68 69 69 18 " 00 2E 30 69 00 0D 31 6E 00 00 00 63 61 5F 01 00 69 5F 01 00 75 73 0B 08 00 6F 0D 02 00 78 5F 01 00 00 64 01 : : : : : : : : : " " " * " . 2E 7D 2E 66 72 14 5A 65 72 00 0D 64 73 69 00 07 5F 69 00 08 6F 74 73 0A 08 62 73 00 00 63 61 5F 01 00 69 5F * " 00 00 0D 00 64 69 00 00 6C 00 0C 08 00 69 73 0D 00 6F 00 01 00 00 73 5F 01 00 63 ................ .......e....... Pr_Linux.docf... ....ris_fstab... g.......ris_fdis k_l.h.......ris_ ls_li1..Z....... ris_inode_bin... j.......ris_bloc /home - , 0 " "( 02 14 66 62 66 72 18 6E 62 00 00 0D 00 64 69 00 00 6C 00 02 08 00 69 73 0D 00 6F 00 01 00 00 73 5F 01 00 63 ................ .......}....... 000000ux.docf... ....ris_fstab... g.......ris_fdis k_l.h.......ris_ ls_li1..Z....... ris_inode_bin... j.......ris_bloc , 0) Pr_Linux.doc) " ( 02 14 66 62 66 72 18 6E 62 , 0) Pr_Linux.doc) 0 2 : : : : : : : : : * " EXT3FS 01 20 30 14 67 6B 6C 72 6A 02 00 78 5F 01 00 00 64 01 " " " * 0x00203000 0x00203010 0x00203020 0x00203030 0x00203040 0x00203050 0x00203060 0x00203070 0x00203080 " /home. 18 - " 0 " " , * , /home *( * " 17). " *) (01h), , " (0Ch) * " – 12 (1" *). $ , *) (00 14h), 0 * – 20 . (, 4* 00 0D 65h * " " inode = 527717, " . / " ", 1 * ( 18). 4 , «ux.doc». * " " *" , "** 00 08 0D 7Dh = 527741, , inode " ) * *. $ " 45 08 - .9 0 " *, "0 1 "* , "* , . "0 " 0 ! ( ") 80% * ", - " * , . " , , " [11,12] * " "( " * , " " lsdel " 0", . ) *, ". . debugfs. 9 0 « " * * - , " ) )" " " - 1 ( ( inode - ") " ) " " )" * " * " * " *" ". . * » ( ( * lsdel.out) : " ** " " " 0 "- lsdel | debugfs /dev/hdc3 > lsdel.out 4 ", lsdel, *, inode, lsdel.out, " 0 * : cut -c1-6 lsdel.out | grep "[0-9]" | tr -d " " > inodes " inodes . " , " 0 " * inode, ) 0) " : - sed 's/^.*$/stat <\0>/' inodes | debugfs /dev/hda5 > stats stats ) .( (" - " 0 0 *, . * . " , " * " ), " * $* stat. " inode " "0 . 0 " * ( -" ) ) * *( " * ), * , " ,46 " * * " * " .$ *1 * " , , , )" , * fsck. $ " , 0 ". $* * "0 ( *" ) ) ( " , , *) * " , , ". 0) * " fsck (filesystem consistency check – (" ). > " " 0" 0 *: , , 0) , , , * , " , " * inode, , )* , 0 ) "* , ") ) " " " " * * " ( /lost+found, . *, * *" "0 .# 1" , 0. 1" " , ) " *, " . " ./ 0 " * " "" Linux 1. 2 " fsck "0 " " Linux 0 ** " " . *». 0 * « 2. " *" " "– " " 3. % 0 ( "0 " 0 * , . . inode *. Inode * " . * ") ) 0 ): " inode ( " debugfs " " . open –w /dev/hdc3 47 , * . " , ( " ( debugfs. $ * 1 "- 0)": " ( " ( " ", - 0 .9 1 - " " */ 0" . lsdel " inode. 1 $ " ) *" ". stat <inode> ( inode, " * . " * ", * - dump <inode> out_file . *" . 0" ncheck inode_number "* "* . " seti <inode> &, *. ) " «1». / " " inode "" " , ", mi <inode> " ( " 4 " : "( " ( " inode *" "* ***0 . * " ( . inode, close 4 quit . " ,1 # , ) " , ) "1 * 0 . " , " * ** "( . * " * , ) " FF. 4 ", " ( * * 0) ), " 0 * , , 48 - inode " . 1" , 0, *) .> " 0 , * ** , 0 0 "" 0 " ( " ). # " , – ", ( * " "0 " ", UNICODE. 0" ", ", " " "0 .> "" .$ " * * . 0 " " 0 " " *, 0 " "" $* "0 ". "", " grep, fgrep . . " * * , "0 49 " , - ( "" - 4. 3* 4.1. 9 0 *" " .# 1 ! ( *" ") +/ ' ' / )"! & " " # * "" " *» " " " "" " 0 "* « 0 " , *" ". 1" (, *) ) * " / )) " 0" ( (,* * * ". " "" " * ( " " "" " ," " ". ( "0 ". " " ( , "0 , , )* " ( . ," ) " , 0 " ( ," "0 " . ( " . "0 ") ") " mv (move) * " rm (remove). 1" " * "" .$ , ") " , * , " – * .% ( ) . ' " , 0 * ) " ( . "( ") " ls –la " "0 « », – " “ b” . % " " ** , ) ) ( , , , , " " "). "" ** * " – "(* * * " " ( " ). 4 * "* ,"0 * ( .> * ") " mknod, * . ( *, *( ( " .' * /dev (device – ). , " ( ,"0 " " ": fd0, fd1 (fd – floppy disk) – 9$, hdXY (hd – hard disk) – 0 (" ) IDE". 5 – " a,b,c,d, ) 50 " "! * "(– (master) , b– (slave) . .), sdXY (sd – SCSI disk) – 0 SCSI", lp0, lp1 (lp – line port) – , ttyS0, ttyS1(tty – teletype) – , tty – " , audio – , ht0, st0 – IDE SCSI " . IDE. Linux )" ": /dev/hda - “ master” " " , /dev/hdb - “ slave” " " , /dev/hdc - “ master” " " , /dev/hdd - “ slave” " " . ) " * " ", "" (" . IDE"0 32 . 4" ** * , 28 " –* . ": /dev/hda2 – , /dev/hda6 – . ", " IDE“ master” “ secondary” " , /dev/hdc. $* * " " CHS, *) * A " , ", * 0" *, " fdisk –l device, device – ( " ): Disk /dev/hdc: 10.2 GB, 10248118272 bytes 16 heads, 63 sectors/track, 19857 cylinders Units = cylinders of 1008 * 512 = 516096 bytes Device Boot /dev/hdc1 * (LBA) /dev/hdc2 /dev/hdc3 /dev/hdc4 (LBA) /dev/hdc5 2 19. " ( *, l /dev/hdc, " Start 1 End 4161 Blocks 2097112+ Id c System W95 FAT32 4162 4365 19468 4364 19467 19857 102312 7611912 196560 83 83 f Linux Linux W95 Ext'd 19468 19857 82 Linux swap " ( *, "* " 196528+ " 19, * ) ": )A " 10,2 51 fdisk –l /dev/hdc * " (10248118272 fdisk ); 2 " * " : 63 (* " * * * " .$ ," 0 0 ") 16 " " " * " .! - (19857*4=79428). % /16 /19857 ( ./ CHS (cylinders, heads, sectors) ") " , " 8 ?? ) 0 , , . # . ( 516096 ). 4 ( ; 0 " 0 *) * - * * " , "* " ( 0* ") * (63 *16 * 512 – 0 , * * * , " ". –( "(* * ; " " ( * - 0" "- *; /dev/hdc1 – ;1 " " “ W95 FAT32 (LBA)” (Id “ c” ( " ), ") * 14161- ( " " 2097112 1024 ; /dev/hdc2 – ;2 " " “ Linux” (Id “ 83” ( " ), ") * 4162 4364 ( " " 102312 1024 ; /dev/hdc3 – ;3 " " “ Linux” (Id “ 83” ( " ), ") * 4365 19467 ( " " 7611912 1024 ; /dev/hdc4 – ;4 " " “ W95 Ext'd (LBA)” (Id “ f” ( " ), ") * 19468 19857 ( " " 196560 1024 ; /dev/hdc5 – ;5 " " “ Linux swap” (Id “ 82” ( " ), ") * 19468 19857 ( " " 196528 1024 . , (" ( . SCSI. Linux ) : /dev/sda – ; /dev/sdb – ; /dev/sdc – ; ... /dev/sdp – ( . ) " , 0, IDE", * " ", "" (" . "0 15 . 4" ** 52 , * . ": /dev/sda2 – /dev/sda6 – $* * 11 – " * ; . " , • /dev/null – 1 "0 0 *« 0 • /dev/zero – « *1 *», , • /dev/random – "- 0 – *( ) *, ). " - * *) ( ") - - "0 ( "" "" null, ) 0 - ", • /dev/loop – . * )* "0 ( ). > : " , , 0 * », .# , * - * " - " "0 0 .> ( ) : , * ( ( od /dev/zero > /dev/null od < /dev/zero > /dev/null « ( "* " »" "( 4.2. / " ! * " > 0 " 9 * * )2 ! . * ,« " * 0 –1 .9 ") ) 53 *. " * " * * - " )" ".. " " *– * )» ». " * " " , " 0 «" # » ! ,# , ". ( 0" " « * ( *, " 1 /etc/fstab. . *. – - 1" - "* /etc/fstab, - 20, 0" (. dev/hda1 dev/hda2 dev/hda3 dev/hda4 devpts /proc /dev/fd0 /dev/hdc / /mnt/ntfs5 /mnt/fat32 swap /dev/prs /proc /mnt/floppy /mtt/cdrom " ( ./ " 2. 4.1. /proc, "" * "* 3. / 4. • • • • • * ( " * "( ) 0 * * * 2.5, ( *0 0 " ", " , /mnt/floppy ( ) 1 0 0 0 0 0 0 0 , ", * *1 "* * " ( " 1 0 0 0 0 0 0 0 /etc/fstab 0" * , ( defaults defaults defaults defaults gid=5, mode=620 defaults defaults, users, noauto ro, user, noauto 20. . 2 1. ext2 ntfs vfat swap devpts proc msdos iso9660 * " )" ." : devpts. * 0)* " *. % "" - ( " /mnt/cdrom). > ) " ". " .. " Linux *"", " msdos, vfat (FAT" , * " " 0- ( " " " 32), ntfs, ufs, iso9660, proc . .. " Linux ") " . " ( ( * " " ( fstab " * " ". ro – (read only) – * "" *« 1 ** * rw – * "" ** * async/sync – " " "0 " * / , exec/noexec – 0 " ./ " ( "" , suid/nosuid – " " SUID/SGID, *) * " " ( 54 " ( mount *» ( ), * - " *. > - , - "* *" ", , " ," 0 - " , • nouser/user(s) – *" " ". " user , " " " *" 0 .# * * " " ,1 * : user=ivanov. " user users * " . " user , " "0 , " , users " " . • defaults – " " , "* " rw, suid, dev, exec, auto, nouser, async. # " ( " " defaults user(s), * " " "* * noexec, nosuid nodev. 5. * ( ( "0 0 0 1. # ( " , 0– . 6. @ ( * " fsck (file system check). # «0», * " * * (* fsck " 0 " ext2fs, ext2fs), ( «1» «2» . « " "0 " 0*" *" mount. > " » " )" * "- ") ". ": mount –t type_fs device dir, " : mount –t msdos /dev//hda5 /mnt/floppy 0 0 " ) " "0 0 " "* * * " EXT2FS, EXT3FS " " . 0 * "" e2fsck " - * "" 0 ", * * e2fsck. > , (" .# " A( ", ) ) . : * * e2fsck -f /dev/hdc3 55 " 0 * * " * e2fsck -fy /dev/hdc3 f– ,y– 1 $" . * " , ") * umount. " : * " - umount device umount dir # * , " ) " . " ( * 90 " ) –1 0 ", , "" .$ * " * , 0 *( 1 " 0 1 # *– " ! ,# ) 0 : .), *" ) * *. 4.3. * ' ! % , * .9 0 " "* . . (, " 0 " - * , " * , " , 0 , * . ) <* * . * "0 " ), *, "- " ( 0") "* *, " 1SUID GUID. . "* ( *, )* , * 1 . ( "* *– " ** , ) , . * "0 "1 " * " A , " *. " /bin, /sbin, /dev ( " " *" ( . ." , "0 " ". ", ) " " " .9 " * ( * " " (. /, ", ping " 0 ) ( ) * " *. " " ICMP (Echo_Request), 56 ) 0 " ,1 0 ping "" , " , "" . " ( *" ( * ( " 9 ( * (( 0 " " * ( » – Root Kit, " " " * * - ) ". "" , * "0 - " "" , " ( ", "0 " "ls. ! " " . *) . "- " * 1 * "" )" ) * ", * * * . " 0* " ( "" .4 1 * 1 * " "– - 0 * .. "0 1" * ** * 0 * 0 ") (* " *, *– - /bin , "1 0 *( *) *). ! " "" /sbin, " , - * " , ". " *0 ) " * - " 0 * "0 *" * 0 ( " " 57 " - , , *" " . " " *" 0 ) " " ( * " , " , ". "0 " " * " 0 ) "" , " – "* , .$ * *, * ) . * " * *, 0 1 " ). / ) 0 * .! ) PATH. # , "( "** * * " "0 * * " 0 * ). "- , "" " , ) " , * « * " , ( *" – 1 " " "0 )" ) " UID , - . su . " " " *, . " "0 0 * * 0 ". 4.4. '4 / ( "* » * . UNIX 0 inode, *" ( *, 0 ! «% !2 ! !" » :« .% 0 " –1 !0 " , * - !2 ) " * - " ," "0 " – 65536. ! "– , .. " " ** * 1 ", * )" "" " * *. 9 0 " * «0 "» ".= . * , ") " , ") . *" " " , , "* *. "* ** * 0" . ." –1 ( . * ** *" , " *) . " " * "" . " * :0" " "0 " * ( *, *. * * ) "" . . , * " "0 . " .# " "* " - 48 " , * " " : 12 4 . inode " " , " " ** * * " ". "* 48 " ,* * * . ." " * " * . < – "" , * ( " ") /tmp. ", "" "0 , " " * . " 1 ", " , ( )1" . * * " "" * .# " "" , "" "0 " 58 , ) " *, 0 " " " * , " 48 " , " " inode. / * , 0 "- ", /tmp "0 " 0 . #) " )* *, "* ""- 0 "* 1 ". / , " , – "- "" " . ( - ( "( .4 ) * /tmp , " * " ** " ( . $* * , " ", (* 0 , ( ( mkstemp tmpfile, /, ( * mkstemp " " * * ". " "* 0 , 0 . , ". "" , ", " ( " ", " . * " . ( * "(* "* * " ". * 0, * **, * "" 0 " " " Windows UNIX * " " . Linux " * " "* , "* " " * "0 *, ( "( 4.5. + # ) & ! * , 0 " * *, ( " * /var/log. * "(* * " " ** *, " .& " * "" " , ( * *< "" . " .log ( * " ** * " /etc/init.d/, /etc/rc*, /etc/rc.d/, var/log/. " (0 ) . Linux "(* ( " "" "" " A 0 * * . A 59 - * ) ** 1 , , - 0" " 0" 1 % /var/log 0 “ cron” , ; “ debug” , " " 0 * "(* * * ; “ faillog” , ", 0 " " )" ) 0) " * " "" " , . : "( 0) * "( * ""; 1 " “pop3” 0) - "- "( 0 * " " " *A *( * 1" " - “faillog”); “ lastlog” , 0) "( "( * 1" " - “lastlog”); “ maillog” , 0) "( " “sendmail+procmail” ( 0 * ," 0 0 *" "" “mreport”); “ messages” , 0) " "( " ( - “info” 0 “warn”; “ secure” , 0) "( * *" " root; “ wtmp” , 0) "( (* "( * 1" " - “last”). 60 / " * *5 ( ". - 0 " . , * - , 0 ) 0) 0 " " " , "( 0 " 1. 2 2. " ( 7 20 * " <" "0 * 6 * 0 " " " 0 . 3. $ * * * " 0 " GNU Linux. $ * ) ( " * RedHat; Mandrake; ASPLinux; Slackware. = *" * " . " " 0" . "- *, *) . * * * . Linux: - " ", *" ( * "0 , 0 0" " Slackware Linux 9.1, " . " .# ", " Live-CD ( 0 ( " " 0" , " * . * * (Bourne-Again shell) * " Lde (Linux Disk Editor). % " , 9.>. " ". " ** * * " " " ; 2) - 0 ). "" - " 4 " * 2 Bash *"* * " .$ * ( * ) 61 - 0 " "* , "" - ( 0 *( * * .9 0 4 . ** *. 4 " 7* " * ** * 0 * * 58 " - 0" "* *. " . ( " 1" *( Midnight Commander "0 - " " . -1 , ". "! ! * " Midnight Com- mander . ( * *. & " - * - , ,#- " * " " "0 " - * ). < " " * " * . ' *. ( ". " " , 0 , " " . 62 - " ", " Linux ( man. " " "0 "0 , - 1 - 0 " ( , , " 1 * . 0 " " ) " * " , . " ($ - *" , " ". " " - "" * , . " " "" - 0" " . 1). *) " « ! ,# )2 1 : )' 1. 4 3. ! * 4. 0 ! * " " Ctrl+Alt-F1 (Alt-F1) * , "0 * *. < " ( * " " ./ ( root " " " * , ". *. " ". ($ - " ). " user1 ") " ls -la / , " 5. . " - ". " " * *. & " "0 - ) " " " * $ » ", ' 1) user1 ". Ctrl+Alt+F2 (Alt+F2) user2 "0 ) ") 2. . 91 "! ' 4 7 /root. * ! " - ,#- < * " * . 0 , ".. 0- / home user1 user2 qu1 qu2 qu3 qu4 jan feb mar r apr may jun jul aug sep oct nov dec ' . 1. * . 6-7 * 63 temp1 temp2 6. " 777 " mkdir -m /home/temp1 mkdir -m 1777 /home/temp2. " /home/user1 /home/user2: 0 755. user1. 7. * " mkdir, "- " * /home/user1 " " : qu1, qu2, qu3, qu4. < * ) ": (qu1 - 777, qu2 - 404, qu3 - 1333, qu4 - 505. " : cd; mkdir -m 777 qu1). . " ) " ls /home/user1 ", .% 0*""" ? "? 8. 4 "" " ". $ * 1 umask 022. * , "" " " ** , " ". 9. 0" " " (jan, feb, mar), (apr, may, jun), (jul, aug, sep), (oct, nov, dec). 0 " *( ) . "," cal 1 2004 >jan )" jan * 2004 . , ( )" , 0" . " "" .$ * ( " " cd pwd. " ? "? 10. . " ) " chmod " 0 " " qu2, qu4 " . 1 " 0 . 11. . " ) " cd ls 0 " .$ * " " " : cd ls. " 0 " : ls " ls -l. * ? * " ? "? 12. 0" " " "" ( ", cd /home/user1/qu3; cat aug). . . 13. 2" * user2 /home/user1/qu1. . /home/user2 quart1 " ( " ) * (cat jan feb mar >/home/user2/quart1). . " ) " file . 1 " cat. ? * ? 14. . " ) " chmod 077 quart1. . , " ( ) * , * ?? " , ( ? 64 quatr1 4700. % " 1" ?% *1 " " ?% " " ? 16. " * may aug user2 ( " chown). user1 user2 , " * " .9 0 user2 * " " ?( user1 user2 users). 17. " * user1 /home/temp1 /home/temp2 c ") " ln "0 " dec "" dec_h1 dec_h2 ( ": ln /home/user1/qu4/dec /home/temp1/dec_h1). ? " * ? "* 1 ? 18. . ") " ln -s /home/temp1 /home/temp2 " dec " " dec_s1 dec_s2. ? " * ? 0" " .? *? 19. " * user2 ") " cp /home/temp1 /home/temp2 dec "" " (dec_copy1). ? " * *( ", ** * (" )? ? " * 1 ? user1. 20. . " ) " rm dec. ? "0 "" " " " ?? *" ? ? 0 * , ) ( " )? 21. " user1 /home/temp1 /home/temp2. % ? "? -* " * user2. < * . 22. qu1, qu2, qu3, qu4 ") " rmdir ( ** ). < * . 23. " " root, * " hattr, feb " . " (, " * * mar. user1. . " ) " lsattr -l . 24. " * user1 finish ( feb mar ( *1 " echo finish >>file_name). -" (,< * . 15. * 65 25. * user1 " . 26. . ") md5sum " * ") " rm -rf qu2, qu3, qu4 " /home/user1/qu1. $ " echo ( 1 ") >>/home/user1/qu1/jan). . 27. . " ) " cat /dev/fd0 .< * ?$ * 28. " . : rm ! 29. * " " , " * 4) ' ". <* "" " echo "" ", a ( 0 *, ? ( " root " 12" halt. - ): % "0 " EXT2FS? % 1 * ( "( ? % ") ? " "0 *" , «0 "» " ?$ * *" ? $* ( " *« " » ? % " "" * ?% "* * 1" !" " ) " chmod –R 555 / . ? "1 " 66 , ( " " ? : ? " " * « 1. 4 " 2. . 3. 4. 5. 6. 7. 4 ! ! " ") 92 # ! ") EXT2FS» 7 ! ,# ( !$ " ! " ) " Ctrl+Alt+F2 (Alt+F2) user1. " " " root. ". " lde . " root floppy. ." " " ") " mount -t auto /dev/fd0 /mnt/floppy. . *" : fillfile lde /sbin. "" lde * " ext2fs (linux disk editor). . " ) "" fillfile " ". ' " "umount /mnt/floppy ( " * !) . . ") " ls -li / " . " ( (inode). " " *? 9 0 1 "( " (1, 2 4 % )? ! " " " ( " , ls -li /bin | more). . " inode , *) .% "0 1" )" " *? . ") " cat /etc/fstab. 4 " ", 0 " .4 " " 0 , "" * " EXT2FS ( " , /dev/hda3). % 1" " ) *, * linux disk editor. # " 0 "* * ", " EXT3FS ReiserFS, . 0 "" " ", "0 , * ( " " " . /home. . " ) " fillfile file_size symbol , " " , "" . ", ") " fillfile 600 b )" " " b < " " 600 , 0 " b. . " ) " "" " ". ! ,# #! ") ' " ;4 < /mnt 67 ls -li 8. % " " )" . " ( . . ") " ( inode ", . " inode_number /dev/hdXX " " " % % : " ? ? . ? * ? ") . - (, ( Block count? ( -i " lde " - 1 . " lde -b block_number /dev/hdXX | more 1 " . ", " * )" * " ". 10. % " rm file_name .. " ) " ( inode . ? " -? 11. . " ) "" fillfile )" "" " ". ' " 0 " ") ( " , 500 ). 12. . " ) " ( inode . ", 1 . * "( «" » 0 ? "? 13. .. "" " "" ( " , 5000 ). , " . . 14. . )"* " " " "" . , " 0" , * .% "0 ? 15. . * " " 10000 .. " ) " chattr +s file_name * , ) . , , " " lde –i …., 0 . 16. * , * " inode .. .( 0 * .). 17. . " ) " lde -b 0 /dev/hdXX | more 1 0" ( " 0). 4 9. . ( " 68 1024 ( 400h) * ") * (LILO - linux loader). . * ") * 400h " " 1024 .. " ) " EXT2FS 80 ( *). " , " "* ( " *. * " : . "0 "? ?" " ? % <" *0 *? . "" * *? . ) "0 " * " ?? " *? % * * "?% ? 18. ' " Group Descriptors, " " ."0 * ") 800h " , . 1" "" 4 ( 0 " * ). : ( (block bitmap), (inode bitmap), ( (inode table). 19. " ( " inode table ( " 80h . *inode 0 ). . " ) (, , : 1 ", (( * ," 0 ), " , 0 inode, , "" ", " ( . 20. . " ) lde " " . 21. " )"* " , inode " . 0 1" . 22. . " ) " , * . $ *1 , " ls -li /, " inode " , " ) lde -i … , " " .. "" , " *. . . 69 23. ! " " . * 24. C , " " * , " ( . " " " .. "- fdisk –l /dev/hda ( " , 0 ) " , " * 0 "" " ( " . ( , " " fdisk, 19. 25. . " mkdir /mnt/abcd, 0 " *. *" mount –t type device dir, type – " "* * " (ntfs, vfat .), device – , ) " "" " , dir – * " *, " Linux " . Windows*. " * Midnight Commander " " ". 26. $ " " Windows* ") " umount device umount dir. % " " " * " 0 . 27. . " * *" "" /erase, 0) " , " 1703. . " rm * . ( ,*) " * rm. 28. . " ) " find " " ": ") SUID (find / -type f -perm -4000); , " ( " (find / -type f perm -2); , ") ( (find / -nouser); < * , " * *" ? ") " % * % " ? " * 4) ') " EXT2FS ( ?9 0 " " 0 " fstab? ? " * Linux " 0 " " ? « " " " 0 *1 " 70 "? ? 0» *? fstab " " " 9 > * user *? " " " * . Linux. users. ? " * "- "( "0 *1 "( " " * ) 9 " * - » . Linux? . % % *" «" * "0 ,0 - inode? .% " ? * 71 " , " ""0 ) - (? « ! 1. 4 " 2. . " ) 3. 1 7 )2' - "" )"! ! ( !$ ! " " " " ) " " Ctrl+Alt+F2 (Alt+F2) user1. ' % )"! - !"! " - ! !1 * : , " 93 Linux» "! " root. ". " )"! ! "! "( - , " super- " , . " ") " format /dev/fd0 fdformat /dev/fd0. 4. . ") " dd 0 /home/user1/floppy. % " ** 0 . 0 0 , 100. # " , 0 0 *" * " 10 " " 512 . * 0 ( " conv=noerror, *) ) 0 . 5. . " ) " cat . ", ( " * * ). ' " 0 "" " <" . 6. . " ) " cat "(cat file_name > /dev/fd0). 7. " " * /mnt/floppy. 9 -* , 0 , " ** * ", . " "0 * « "» ". 8. " " , " . 9. ' " .. "0 *" "( 0 " *. 10. * fillfile, " , 0 ; 2, " ** "" “ A” “ #” " " 500 10000 . .. ") lde " . 72 11. . fillfile ") " " "( , " 12. " *. 13. 4 " " inode " .> " " 14. . " ) " " ls –l, . rm –f " 15. . ) " 0" * " lde ") " 0 . 17. . 18. % " ") * 0 "» " cat " ( debugfs < ". " * ls –li, - " , * « , ". " "" ") , 16. . * * . . " - " " .' /etc/fstab , " " EXT2FS. . 0- . " * - * " , abcdefghijkl). " " , " , - " EXT2FS * *( " open device). " device 0 ( " " Linux. 19. *" lsdel " inode . " , ". 20. 0 " ") " stat <inode> , ( . " , ) . 21. # 0 , «1» ) inode .$ *1 ") " seti <inode>. 22. . ") " mi <inode> "* * «1» . 23. " "* .> * ") " ncheck <inode>. 24. % " close EXT2FS 0 " ", * quit, debugfs. 25. * , " .. . 26. ( ** . 73 27. 0 " , 28. * shred, * - . 0 . " « ? " % » " % % ( % ) "? % - " , "" 0 ( " " , , ? *? " % ' ". * " % 4) ? * 0 .. . * "0 * * ). "" 0 0 * "( "" ( ", « *? " » <* * - 00 , 0 * *? "- - " ? * " 0 Linux? " , ". 74 0 * « "! ! ! " ) " 2. ! - 1. 4 1 *" /etc/passwd. ! , & 0 cat # ," # . 1 " 0" ". " - /etc/shadow. /etc/shadow. " 0" , - , 1.01.70 . , : # 0" 7 9 , - . , - ) - $ , $ - , , - , , ." , , , , % 4. ( " root. )"! ' $ ' 4 ! "! " root, " , , ( , # $" , # 3. ! 94 # ! ") Linux» 7 '( ! . ** (10) : w_gromov, n_kalinina, e_ivanova, r_klinova, b_rebrov, k_beglov, i_frolov, d_lavrov, m_kruglov, t_uporov, ) " * " " " * ( .' "( 0 ) : " *" " *: w_gromov, n_kalinina, b_rebrov, k_beglov; *: n_kalinina, b_rebrov, k_beglov " " ,0 " . "0 " * , * , * w_gromov; *: i_frolov, d_lavrov, e_ivanova " ("( " " )" " " 75 ". " ", " " " " "; 5. 6. 7. 8. 9. "( ( (; * ( , " - *: r_klinova, m_kruglov, t_uporov " "( . 0 * * 0" *( " ( ); w_gromov * * * " * " " ( ( . 4 " * " w_gromov ", 0 * *. 0 , " " * ?% * " ", " " " "* *? . ") " groupadd : alfa, beta, nabla, sigma. " " groupadd -g GID group_name. GID " 0 , * " 100 ( " , groupadd –g 101 alfa). . ** . ' ( (" ) (. , " 8" , * .$ * e_ivanova, r_klinova .' " " ", " * ". ", * * ) * " "( . * (w_gromov, n_kalinina, e_ivanova, r_klinova, b_rebrov) ") " useradd. . ": useradd -u UID -g group_name -d dir_home -m -p password -e date_del_user user_name. , useradd –u 501 –g sigma –d /home/n_kalinina –p v5g7K2S4 –e 200401-07 n_kalinina. " -m "*, ) ) . " " "0 .% , # , *#%^.... & # UID , 500. $ * * * " -99-$$. * ") " adduser, * * " 0". "[. " , " " *, ," , * ""0 .$ * 76 " " # adduser adduser .' #. Enter. " Linux 8. % - , , (1 " = !# & !$ & 0 # '! ! /home/i_frolov T+ 10 /home/m_kruglov T+ 30 /home/b_rebrov T+ 12 /home/d_lavrov T+ 60 /home/e_ivanova T+ 30 /home/t_uporov T+ 15 /home/k_beglov T+ 45 /home/n_kalinina T+ 30 /home/r_klinova T+ 90 /home/w_gromov * / 4 ! - i_frolov m_kruglov b_rebrov d_lavrov e_ivanova t_uporov k_beglov n_kalinina r_klinova w_gromov 10. UID &' ' 501 502 503 504 505 506 507 508 509 510 * /etc/passwd 11. 4 , " " 0 * " " # $ 12. *1 *? " useradd !% , , " *, *) . /etc/shadow. *. " *, e_ivanova ! r_klinova " $- # .( /etc/passwd ), passwd. useradd su ") " * w_gromov. exit " " " ") " " ?( Linux " "). 13. 4 Midnight Commander 0" /etc/passwd n_kalinina " * (" 0 " * .. " * , 77 - (# " .& " " ?. "* (F4) * "), Midnight Commander, ") Ctrl+Alt+F2 (Alt+F2) " " n_kalinina, «"» ". . * 1 .4 * * n_kalinina ") " exit. 14. d_lavrov ( .. ") " userdel -r user_name " "- " ". * " *, *) ( * (. 15. 4 " * f_mironov "" ( 0 "!). 16. r_klinova " " .4 ,* " " 0" * (" 0 " " ") ", * *. * " r_klinova ", *1 * " . 17. 4 " * k_beglov, " passwd " . * qwerty. 18. " k_beglov zxcvbnm. 4 " ") " chage (change aging " "( ) *1 * " " "* * , 5 * ". . ( *" " * *? 19. " 1 /etc/sudoers. " ", )" *" *" sudo: e_ivanova " ", b_rebrov " * ( . ," * *" ") sudo *1 SUID? 20. " * f_mironov cal 2004 > /home/f_mironov/cal2004. . " ) " su * b_rebrov ") " " f_mironov " ( n_kalinina. % " ) ""0 * ", * "“ ” " "? 78 21. " var/log " " , " " 0 4) ' ) " * ( . ? " <* " ( ? 90 " , .) " % *" "- * . * $ Linux % " * "? " * " "? " ( * ( ") " ?% - " * "? " sudo "0 ( 79 /etc/sudoers? - « 1. 4 2. % " 3. . ") " * 95 Linux» 7 !'( - 1 " " " " root. ( - <Ctrl+Alt+F2> (<Alt+F2>) " user1. " root /mnt floppy. ." " " " mount -t auto /dev/fd0 /mnt/floppy. . *" " " signorer /bin. ' " umount /mnt/floppy ( " !) . " # /proc 4. 1 " /proc (ls -la /proc). " ( * " (* *" "" ( . 1" "1“ , " ( ( " " ( PID. $ * 0 ) " ( /proc ) , "* "1 ( . 5. *. " , 0 0« » ( ". . 1). 6. "( , *) * " ( ( ", cat /proc/103/status). ? " " 0 * " (* *" *? * 1 " (* * "( *? 1< & !! 0 7. 1 ( : 0 8. % " : " ! ,# 0" , , ” #! ! * 1 % " #! , " ( !! ' ( 2 " ps -efl | more *" ( ( " "( "0 ") 1 man ps). ' " "( . , " , ( ( " ", , " ), * S: ( * ) *-R! ! , 0 ) ) - S, - T, " - Z . .), )" " " PRI ( "( ), " NI. ( - <Ctrl+Alt+F3> (<Alt+F3>) " " . 80 * * * - D, - 1 - top * ) * ( . "* ( ( , ) * 1 ) "( (* * " " ). 9. ( od /dev/zero > /dev/null. " od « *» . , ") " top " ( . ( ) (, PPID « *», ( "0 1 " *), ( ( %CPU "* %MEM. 10. " " * ") " od /dev/zero > /dev/null & 2-3 ( . 11. " * ( 0 ) , ( "* . " * * ( , *" " " *? 12. . * user1 " 0) " ( .$ *1 " renice -10 PID. " * ( ? 13. ) " " . 14. * " 0) " ( " renice 5 PID. " ? 15. " ) ( . 16. ( " kill. * 5' 17. . " abcd. .( !'( * "0 ") " "! cat: ( cat >abcd #! /bin/bash while : rem do echo HELLO! done Ctrl+d * ( , 1 " ! " chmod, *. 4 ( 0 " * 81 ( * HELLO!) 18. , ( "« " ") -» (* " (, *, top ) " " ( "" 1 "0 "). ( PID. 19. 0 " Ctrl+C ( .% " 1" * ( ? 20. (, " -"" ( (" kill –15 PID_process). 21. 4 /bin signorer. 10 ) " ( - (Ctrl-C, Ctrl-\, Ctrl-Z). ( ( .% , 1 ( * ? 22. « - "» ( kill -20 PID. % ( ? " 1 " , . 23. . " ) " kill -9 PID 1" ( *. . " . * (? * ( ?% * "" "" * " kill -9 PID? 24. . " ) " echo $PATH " * user1 , * *" , " . " * ? " PATH " ) (.)? " PATH * /sbin? " "0 " * *" ? 25. " *( " , renice -10 PID, date -s 0). % " d? 26. " *. 27. ", . <* , " "0 " « "» " "? , -" " , 0" " * " (* ( ", " , " ?). . 28. . " * *" " " SUID /bin ( *" ( " " " *, " SUID " " " «s» ( ). % " *? 82 29. " , " , chattr). % * " . " ( chattr . . . - "( )" " ", , " * +i ). " 1 "! 30. . " .$ *1 "0 " od /dev/zero | tr . 1 | more. * , ") " top , 3 ( : "" "" od, "" ( tr , " *) (, "" 1 more. ( * " .' * ) ( ? 31. ) ( " ( - <Ctrl-C>. 32. ( * ( *" .$ * 1: " user1 * " " mkfifo /tmp/fifo, ls -l /tmp/fifo, " ) cat < /tmp/fifo, " ) cat > /tmp/fifo, (1 ( * <Enter> ( 0" ), ( " <Ctrl+D> " FIFO, rm /tmp/fifo " * "( " " ?% ) * * ?" ? % % ( . , ( " "0 * 1 * - 4) ' ( ,« " ): » /proc? "* " 0 ( ? ( 83 " ( - ()" " - " - % SUID? ( " ? , " * " « ( (? * " 0 .% », " * "" 0 - 0 " " 84 " - "1 "? " ? ( - " "0 *? "0 ( , " * " ?$ * !1 ! - ,!0 !# ' ! 1. UNIX: " " .$* . 3. />. " , .. , ... , /.5 . . .: ;% : * BHV, 2003. 925 . 2. & 1 $. 4 ) * Linux. $ * / $. & 1 . . .: , 2002. 480 . 3. ' !.9. ( * " UNIX / !. 9. ' . . .: & -. 5 , 2000. 528 . 4. % " . !. . Linux -" "" / . !. % " (1 ). 5. 9 9. "" * Linux. : . . / 9. 9 , $0. ", !. . " 1 . 9.: "« *" », 2003. 288 . 6. / " >. . " ( " . 2. / >. / ". . .: , 2002. 1040 . 7 . 9 -% .. . .& *.: . . 2. / . . 9 -% , . . . " , $. % ( 9.: . . "“ *" ” , 2001. 656 . 8. $0. ' * 0 *. & "" / $0. . . .: , 2001. 352 . 9. Glover Robin (31 Jan 1996), HOW-TO : Undelete linux files (ext2fs/debugfs), comp.os.linux.misc Usenet posting. 10.Peek Jerry, Tim O'Reilly, Mike Loukides et al (1993), UNIX Power Tools O'Reilly and Associates, Inc./Random House, Inc., ISBN: 0-679-79073-X. Second edition, 1998. 11.' 0 " : news://comp.os.linux.misc/ 12.' 0 " : www.kiev.epos.us 85 ' 2 =# * */ 8 " cat [arg] file_name – " od file_name – " ** . “ * LINUX * %!" - , # 0" -( .% " * !- ( ” ' , # !$ ) . #1 " . . - #! " : cd – , cd .. – "- cd [dir]– " « " -» , cd / , cd /home/user1 – * user1. pwd (print working directory) – " ) . find [dir] [arg] file_name – " " " "( " : -name $ "" , -inum inode – " , -mtime – " * , -type _# – ( - f, - d, - l, -s .), -perm " 0" . .). 1 ;! ' ( !! , # "!, - "! ! ) "! mkdir [arg] [dir] – .! –m mode . " : mkdir –m 1555 /home/user1. rm [arg] [file_name, dir] – .! " –f – , -d – , -r . " " , " " " «y» (yes) «Enter». rmdir [dir] – . shred /arg/ file_name – " " (25 )« "» inode " " ( *" . ! " : -v – ( , -u – 1 " , -n – . cp [arg] file1 file2 – " " ". cp [arg] file1 [dir] – 0"" " . cp [arg] [dir1] [dir2] – 1 2 [-a – , -p – 0" 0 " " ( " ) )]. 86 – - - , mv [arg] file1 file2 – " " . mv [arg] file_name [dir] – ") . ln [arg] [file_name] [link] – (-s – " ). chattr +(-)[arg] file_name – (-i – " ,- – (, " * ,- – " 0 " * / , -s – . 4 "+" , "-" ). ls [arg] [dir] – (-l – *" ( *, - – , -i - inode). ls [arg] -li "( " . ls /dev/hd* "( IDE. lsattr [arg] [file_name] [dir] – "( (- ) file file_name – "( . " (* " " * /usr/share/magic. fdisk –l device – "( " . ' $1 " =! )"! !$ "! cat /dev/fd0 > /home/floppy . cat /home/file1 > /dev/fd0 file1 ,* . cat /home/file2 >> /dev/fd0 file2 * . dd if=/dev/fd0 of=file_name skip=n count=m block=b conv=noerror * "*( if – , of – , n) ,m" ,b– " ( " b = 512 )). " !' & ' chmod mode filename – " < . 1: chmod wXp file_name " w * * u (user) , g (group) *, o (other) , a (all) , " X * * (+) , (—) - , (=) " " ) *, " p** ", ) ) : r( ), w ( ), x ( ), s ( SUID * user), t (sticky bit * all). " : chmod o -wx /home/user1/file1 87 - - 2: chmod XXXX file_name, X: , , . umask XXX (user mask) - " 0" " . Umask " chown [arg] user filename – , " *, - " ) * *" " 1 ps [arg] (process status)– ! ! -e ( , -f kill [sign] pid – pid (sign = 15 0- '( "! "( ) , -l ( " ,9-" ( *. * ) ( ). " ( . (. (- " (). Kill -9 1 '4 $ !' "! $ "! groupadd –g GID group_name – . groupdel group_name – id (identifier) – " ) * . su (substitute user) *( )" " " *). su " * *( " ). su -user_name - " * " 0*. su user_name - " * " 0 *. # " root, " . passwd - " *( 0 , " ). ! " "0 " "" * " " . chage (change aging) – " "( *. adduser *( * " 0 " ). useradd -u UID -g group_name –G add_group_name -d dir_home -m -p password -e date_del_user user_name – *. userdel -r user_name *( * 0 . " -r * * *" " " *). ! !! " ! ! ,# 88 )2 ! " mount -t type -o option < >< _ > type " " " (ext2, ext3, msdos, vfat, ntfs . .). / auto " "0 " ( ( /etc/fstab) " " ". option ( (ro – , rw – , . .) <& # > - "* ( , " /dev/hda2; < 0 _" ! !$ - "* > , " " * * "( " , /mnt/floppy /mnt/ntfs). mount -t auto /dev/fdo /mnt/floppy - " ( " * * ) * ). umount < > umount < _ >" ". umount /mnt/floppy " . " $! " 0 !=! ! 1 ;! " Ctrl+Alt+Fn = Alt+Fn " Ctrl+D logout exit " Tab ( " ", )* " " ". history " ( " " ). .) " . man name_command 1 1 q. command_name --help " shutdown -h +t * t" . shutdown -h 0 halt Ctrl+Alt+Del - " shutdown -r reboot ( 89 ) . ". )- " 1000 0 " - . . * * ". . #2 ' 2 =# . DebugFS * * " *, * * *" " " EXT2FS " 8 *5 DEBUGFS , EXT3FS. $ * ReiserFS 1 Linux " DebugFS * * * "" " * « » * 0" * " 0 "* " , " * ". "0 " " " * " Bash " " 0" " * *: debugfs –R stats /dev/hdc3 ( *). ", a) " 0" , " .& , "( " 0", - " "0 0 " ". inode - * * * » " " "« < >, / . "0 "( * , " 8. * "- debugfs 1" ) *. ) " , * " * ) " : open –w /dev/hdc3 ( * ). 9 0 * " /dev/hdc3. ! –w *, 0 " * . " ," ( ), *) ,0 * " 0". 0" "0 " * * 0 . * ", " * .# ", " *1 " man (manual – ). ' " "1 " ( *" " ( *" " clri filt_name – 90 .$ * debugfs –w 0- " ) , *". " "0 ) " " " *): "- , freeb block_number – " «0» , ) " " , " " " <* ** ", setb block_number – 0* " " ) «1», <* ** * ". # 1 " , fsck, " ) ", 1 " /lost+found, freei <inode_number> – " «0» inode, <* ** ", setb <inode_number> – " ) «1», <* ** inode * ", icheck block_number – *" , * )* " ./ * " . "0 inode , ncheck inode_number – " , * )* "* " " ./ 0 0 * 0 " " , stats – 1 " 0 -. " 0" 0 "( "" " , stat <inode_number> - " * 0"" . * " Lde, lsdel – " 0 * inode, * " .$ * "( " * ( " " ": lsdel | debugfs /dev/hdc3 > /home/file_lsdel, mi <inode_number> 0*" , * ) *" ( 0 " " .. ** : Mode, UID, GID, Size, 4 " " .. * ) , ( "0 , " *. debugfs: mi <148003> Mode [0100644] User ID [503] Group ID [100] Size [6065] Creation time [833201524] Modification time [832708049] Access time [826012887] Deletion time [833201524] 0 Link count [0] 1 Block count [12] 91 File flags [0x0] Reserved1 [0] File acl [0] Directory acl [0] Fragment address [0] Fragment number [0] Fragment size [0] Direct Block #0 [594810] Direct Block #1 [594811] Direct Block #2 [594814] Direct Block #3 [594815] Direct Block #4 [594816] Direct Block #5 [594817 Direct Block #6 [0] Direct Block #7 [0] Direct Block #8 [0] Direct Block #9 [0] Direct Block #10 [0] Direct Block #11 [0] Indirect Block [0] Double Indirect Block [0] Triple Indirect Block [0] help – close – quit – , " ", 0" " * " Lde * . " ": lde –i inode_number device 128" " inode. lde –b block_number device " " *( " " 0x12345678. open, " – "( | more ". , 1" 92 , 1 " 0) . * " " - & !" " Linux ( ). %. * ' %" * 16.06.2005 &" .- * . . 6,0 ' . * / ( 60x84 1/16 " 0 620002, # ' * 620002, # 4 , ? , 93 .9 , 19 /. 9 , 19 . . 5,41 6 /- “ .” ...
View Full Document

Ask a homework question - tutors are online