linux_web

Page 1

:

9

:

9

.

9

ftp://ftp.linux.co.kr

FTP:

z

.

ftp://ftp.redhat.com :

z

CD 3 CD

:

z

.

ftp://ftp.bora.net

z kreonet:

ftp://ftp.kreonet.re.kr 9

6

CD

.

3

.

. CD-ROM

. . .

1.1

<

1.1>

. . <enter>

. .

,

CD

.

“skip”

CD

.

.

, 1.2

.

[Next]

.

.

. 1.3 1.2

2

1 2 CD

1

CD-ROM

.

CD-ROM

, .

,

.

. CD-ROM CD 1

1.1

.

. .

<enter>

- 1 -

- 2 -

“Korean(

)”


<

1.2>

<

.

1.3>

. ,

.

. “U.S English”

.

.

.

9

.

. .

1.3 .

.

9

z z Disk Druid Disk Druid

z z

. Disk Druid

z

. .

z

. .

- 3 -

- 4 -


<

1.4>

<

(swap)

(/)

1.5> Disk Druid

.

. . . Disk Druid

1.5

.

.

“ 1.6

. “swap”

swap ”

.

.

. ,

.

“ .

/var, /boot, /home, /

- 5 -

.

<

1.6>

- 6 -


<

<

1.8>

1.7>

ext3

. /var .

, . /boot 80MB

,

. / .

9

5G /

,

/home

. /home

.

,

.

1.7 .

. GRUB

1.9>

.

LILO

GRUB .

<

.

[ .

1.8

IP

. IP

“255.255.255.0”

- 7 -

]

IP , D

.

- 8 -


<

DNS

<

1.10>

IP

1.11>

1.12

.

. ,

. 1.9

.

.

1.10 .

9

X

.

,

,

,

, GNOME

, [

X

,

, FTP

/

(Seoul)”

, SQL

.

]

. .

. .

, KDE

, .

. .

,

,

. .

“Korean (Republic of Korea)”

,

.

1.11

3

CD 2

.

. .

. . 1.4

.

3

, .

- 9 -

- 10 -


<

1.12>

.

[

]

.

. z z z , .

CD 9

.

- 11 -


:

.

- GRUB -

(runlevel),

- dmesg, su, telinit, exit, logout, shutdown, halt ,

-

,

-

(bash shell)

-

:

,

,

,

,

. .

(

)

.

/etc/passwd

, (digest)

/etc/shadow

.

<

(one-way) ,

. ?

2.1> GRUB

[I]

.

. . .

2.1 . ROM

(bootstrap

program)

, .

, ROM

(boot loader)

, . . ROM

z

1.

z

2.

z

3.

z

4.

z

5.

ROM .

GRUB

/boot

LILO .

. LILO GRUB

vmlinuz

. GRUB

- 1 -

2.1

.

.

- 2 -

5


.

rc(run command)

/etc/rc.d

.

rc4.d, rc5.d, rc6.d

, rc0.d, rc1.d, rc2.d, rc3.d,

7

,

(runlevel)

. . .

z

1. dmesg

.

z

2. /var/log/messages

. .

(audit)

,

/var/log

.

?

.

(runlevel)

2.2

. 6

0

.

<

5

2.2> GRUB

.

0

(single-user mode)

, .

1 2

,

(without NFS)

.

.

3 4

-

5

X11

. .

6 /etc/inittab

- 3 -

.

z

1.

z

2.

“telinit 1�

GRUB

. GRUB

- 4 -


[p]

.

GRUB

.

GRUB .

.

[e]

“kernel”

[e]

.

2.2

.

single

[b]

[ENTER] .

exit

.

init

, . .

init

telinit

.

, .

2.3 X (GUI, Graphic User Interface) .

TCP/IP

X X 11

<

2.3>

.

XFree86

. XFree86

.

X11R6(X

GNOME

6)

KDE

9

.

. X

2.3

.

: X

z

X

. ,

z

. X

: X

:

. .

. z X

. .

.

z XDM(X Display Mangaer):

.

z

X .

:

. GNOME .

9 .

.

.

,

- 5 -

KDE

- 6 -


:

z

. :

z

/etc/profile

.

/etc/bashrc

.

.bash_logout

, .

X

. X

,

,

X

,

.

/etc/profile

~/.bash_profile

~/.bashrc

/etc/bashrc

. X

?

shutdown, halt

. 4

.

~

, ‘.’

.

,

‘.’

.

. (terminal) (

,

.

, )

.

(console)

.

.

X

. /etc/passwd

(shell)

.

.

.

, hanterm

.

. .

,

.

.

C

tcsh

[sangjin@crypto sangjin]$

C

.

?

. , .

2.4

,

9 .

3

.

(virtual console)

.

‘#’

.

‘$’

4

.

9

[CTRL]+[ALT]+[F1] ... [F6] .

exit

X

[CTRL]+[ALT]+[F7]

.

.

shutdown

.

su

, .

.

:

z .

.

.

- 7 -

.

logout

.

2.4.1 su

.bash_logout, .bash_profile, .bashrc

9

z su [OPTION] [USER]

- 8 -

.


z shutdown

/sbin

, . “hh:mm”

.

-l

,

“+m”

(--login)

-s shell

‘+0’

. (--shell shell)

‘now’

.

. ,

.

shutdown su

/bin

.

, .

.

z .

.

z

root

. “su”

,

“su root”

,

z

.

.

z

. (sync)

z su .

1) shutdown -k now “ . “-l”

.

‘-k’

,

,

‘now’

.

. 2.5 halt/poweroff/reboot

2.4.2 shutdown :

z :

z

.

.

z

z

halt [OPTION] shutdown [-t sec] [OPTION] time [warning-message]

poweroff [OPTION]

z

reboot [OPTION] halt -r -h

, poweroff

. (reboot)

. reboot

. poweroff, reboot

halt

. (halt)

.

. halt -c

shutdown

.

/var/log/wtmp

.

0 0

.

-k

. halt .

-f

- 9 -

?

6

halt ,

.

- 10 -

6

.

shutdown shutdown


1) vi AAA AAA :

vi

, AAA AAA

.

.

2) vi AAA BBB .

.

next

X

.

.

.

3) vi

X

vi

. vi

ex

.

z

. vi . .

vi

vim

+[num]

.

. .

-r

3.1. vi vi

.

3.2.

.

vi [OPTIONS] [FILE ...] vi vi

3.1 . vi

view

. -

. vi , ex

‘~’ vi

. vi

.

. .

.

a i o A I O <

3.1> vi

- 1 -

,

- 2 -


[w] [ESC]

.

[:]

ex

. ex

. vi

‘:’ .

,

ex

[ENTER]

‘.’

.

.

. ex

,

.

.

(

w

)

w filename

{

wq

}

q

G

q!

G

e filename e!

3.4.

r filename

. .

vi

ex

q .

q!

. ex [ENTER]

x

.

dw ex ex

db

.

ex

.

dd dd

3.3.

. [PageUp], [PageDown]

.

- 3 -

,

.

- 4 -

[b]


,

,

.

old

%s/old$/new/g

new old

%10,30s/old/new/g

new

yy %s/old//g

yy

.

p 3.6.

p

. [J] [u]

.

, [u]

[CTRL]+r

. /word

3.5.

word

?word

word

.

, ‘/’

n

‘?’

[ENTER]

.

3.7.

r

vi

R

vi

.

‘!’

.

~ 1) :! ls -al ex

.

%s/old/new/g %s/^old/new/g

old

new “”

old

. new

- 5 -

- 6 -

ex


:

.

- ls, chmod, pwd, cd, mkdir, rmdir, cp, mv, rm, cat, head, tail, more, umask - man -

(prompt)

-

(redirection)

-

:

-

:

(permission),

,

,

.

.

X . .

4.1 ls :

z

.

z ls [OPTIONS] [FILES] z

-a -l -d

all) (

,

,

(directory)

- 1 -

,

) (long)


.

“ls -al”

. man “ls --help”

.

“man A”

A

man

.1)

man - [SPACE]:

.

- [b]: -

. : [/]

[enter] .

[n]

. - [q]: man

.

“ls -a”

‘.’

, ‘..’

. ‘.’ ‘-a’

.

“ls -l kut.txt”

.

-rw-rw-r-- 1 sangjin professor 0 11

15:00 kut.txt

- “-rw-rw-r--": - “1”: - “sangjin”: - “professor”: - “0”: - “11

15:00”:

- “kut.txt": “ls -l”

. .

1) man .bashrc

JLESSCHARSET=euc

- 2 -

JLESSCHARSET .

euc

.


- “-”: - “d": . . . ,

,

. .

.

(owner),

(group),

(others)

. ,

.

, . ,

, “rwx”

,

. ,

.

, .

“110”

10

“6”

,

“664” . umask . umask

umask

umask

002 111

664

777-002=775

. ,

775

.

4.2 chmod z

:

.

z chmod [OPTIONS] FILES , ,

, .

- 3 -


1) chmod 777 a a

777

.

2) chmod u+x a a . g

. u

, o

, a

, ‘-’

g, o, a . +

, = w, r, x

.

.

3) chmod g+w,o-r a a

,

a

. 4) chmod ug+wx a 4.3 pwd :

z

.

4.4 cd :

z

.

z cd [OPTION] [DIR] (path) (absolute path)

.

(relative path)

.

, . ,

‘~’, ‘.’, ‘..’

,

,

. john “cd ~john”

.

cd

. “cd -”

,

. (prompt) .

.bashrc

- 4 -


. PS1="[\u@\h \$PWD] " . source .bashrc .

\d \H \h \s, \v

, ID

\u \w \W \t,\T 4.5 mkdir :

z

.

z mkdir [OPTIONS] DIRS z

-p

.

- 5 -


,

.

umask

.

1) mkdir -p src/hwk01/data src

,

hwk01

hwk01

data

,

.

src

. 4.6 rmdir :

z

.

z rmdir [OPTIONS] DIRS z

-p

. , .

.

4.7 touch :

z

. 1) touch 1.txt 1.txt 0

1.txt

.

- 6 -


4.8 cp :

z

.

z cp [OPTIONS] FILE1 FILE2 FILE1

FILE2

.

cp [OPTIONS] FILES DIR FILES

DIR

.

z

-p

,

,

--preserve=mode,ownership,timestamps

-r

. (recursive)

-d -a

-drp

. (archive) . (force)

-f

. (update)

-u “cp -p a b”

a

b

,

. 1) cp 1.txt 2.txt 1.txt

2.txt

.

2) cp 1.txt /tmp 1.txt

/tmp

.

4.9 mv z

:

z

: cp

. .

- 7 -

,


z

.

-b

‘~’

-i

. (backup)

. (interactive) (force)

-f -u

. (update)

mv .

‘i’

‘b’

. “mv a b” .

) mv -b abc cde cde

cde cde

cde~

, abc

.

4.10 rm :

z

.

z rm [OPTIONS] FILES z

-f -i -r

. (force) . (interactive)

. (recursive)

- 8 -

b


rm . 1) rm -i aaa aaa

.

2) rm -r AAA AAA

AAA .

4.11 cat :

z

, .

z cat [OPTIONS] [FILES] z

-n

. . . “ls -al > dir.txt”

. ls

dir.txt

“cat dir.txt” “cat > 1.txt”

. .

, b

.

[CTRL]+[d]

c

“cat a b > c”

[CTRL]+[d] . .

- 9 -

.

a .


[CTRL]+[d]

EOF(End-Of-File)

. . core

[CTRL]+[c]

.. core

[CTRL]+[\]

.

.

[CTRL]+[z] .

[CTRL]+[s]

.

[CTRL]+[q] [CTRL]+[?]

.

[CTRL]+[w]

. .

[CTRL]+[u] ,

. ,

.

‘<’

‘>’

.

1) ls -al > 1.txt 1.txt

.

2) cat < 1.txt > 2.txt 1.txt

,

2.txt

.

.

cat 1.txt > 3.txt . .

‘2>’

.

3) cat 4.txt 2> error.txt 4.txt error.txt

. “2> /dev/null”

- 10 -


. 2.12 head

tail : head

z

10

, tail

10

.

z head [OPTIONS] [FILES] tail [OPTIONS] [FILES] z

-n=

10

. (lines)

4.12 more :

z

. z more [OPTIONS] [FILES] man

[SPACE], [b], [q] .

4.13 (‘|’) .

,

ls -al | more ls

more

more

.

. more

- 11 -

grep

.


4.14 grep :

z

.

z grep [OPTIONS] PATTERN FILES z

. -f filename . .

-i -l

. -n

.

-c

. .

-w grep . 1) grep -n sangjin /etc/passwd . 36:sangjin:x:500:500:Kim Sangjin:/home/sangjin:bin/bash , /etc/passwd

sangjin

. 2) grep -c apple AAA BBB CCC . AAA:3

- 12 -


BBB:1 CCC:0 , apple

AAA, BBB, CCC .

3) grep -l apple AAA BBB CCC . AAA BBB , apple

AAA, BBB, CCC .

4) grep -w if AAA “-w”

“cliff”, “knife”

“-w”

“if”

.

grep

.

5) grep "run[- ]time" AAA AAA

“run-time”

“run time”

. .

4.15 alias alias

. alias

.bashrc

.

. alias dir='ls -al | more' alias del='rm -i' alias move='mv -b'

- 13 -

alias


:

.

- useradd, usermod, userdel, passwd, pwconv, groupadd, groupdel, chfn, chsh, chage, chown, who, whoami, w, finger - /etc/passwd, /etc/shadow, etc/group, etc/default/useradd, /etc/login.defs - /etc/skel - vipw, vigr

/etc/passwd, /etc/group

. . . . 5.1 . z

: sangjin

z

: 500

z z z z

: 500 : Sangjin Kim : /home/sangjin : /bin/bash

z /etc/shadow /etc/passwd

. /etc/passwd .

- 1 -

,


/etc/passwd .

‘:’

.

accountname:password:UID:default GID:GECOS field:home directory:shell ) sangjin:x:500:500:Sangjin Kim:/home/sangjin:/bin/bash . 8

.

8

. . .

.

/etc/shadow

passwd

.

‘x’ MD5

. MD5

. MD5 “$1$” . MD5 DES

8

. authconfig .

‘*’ UID

.

32

.

32,767

. . 100 100

.

500 . GID

GID

UID

32

.

. , . GECOS

,

. .

,

- 2 -


.

finger

,

chfn

. . . /etc/login.defs

“DEFAULT_HOME”

9

bash

csh, tcsh

.

“no”

. .

chsh

. root

.

0

. 5.1.1. useradd :

z

.

z useradd [OPTIONS] accountname z

-G groups

.

-g GID/groupname -d directory

-s -u

UID

GID

.

/home/username

.

/bin/bash

.

500

- 3 -

.


useradd

/usr/sbin

,

. useradd . z

1. /etc/default/useradd, /etc/login.defs

useradd

/etc/passwd, /etc/shadow, etc/group . z

2.

.

z

3. /etc/skel .

useradd

passwd .

1) useradd john john 500

UID

GID

,

/home/john .

, .

john

,

.

/etc/skel

/bin/bash

useradd

“/home/student/john”

“home/student”

.

GID

GID . “/bin/false”

“/bin/nologin”

.

5.1.2. usermod z

:

.

z usernod [OPTIONS] accountname z

- 4 -


. -d directory

-m . .

-g defgroup

.

.

-G groups

, . .

-l accountname

.

-p passwd .

-s shell

. -u UID . usermod

/usr/sbin

.

) usermod -d /home/john -m -l john sangjin sangjin

john

,

/home/john

. . 5.1.3. passwd z

:

.

z passwd [OPTIONS] [username] z

- 5 -


. -d

root

. .

-n days

.

-x days

. /usr/bin

.

1) passwd . 2) passwd sangjin sangjin

.

sangjin

.

/etc/shadow

.

. /etc/shadow . accountname:digested password:last:min:max:warn:expire:disable:reserved - last:

(1970

- min:

.

1

1

) .

, 0

.

- max:

. . 180

- warn:

0

.

. .

- expire: - disable:

(1970

)

- 6 -

1

1


- reserved: . 3) sangjin:$1$cj4dKJAS$Kttp7ajINcvfdn3tZ65XNO:12295:0:180:7:7:12783: /etc/shadow

sangjin

“chage -l

sangjin”

.

: 0 : 180 : 7 : 7 : 8

31

: 2

, 2003

27 , 2004 : 3

: 12

31

5 , 2004

, 2004

5.1.4. chage :

z

.

z chage [OPTIONS] accountname z

.

-l

.

-m days

.

-M days

. YYYY-MM-DD

-E date

, .

-W days chage

/etc/shadow

.

,

- 7 -


. chage .

,

,

. 1) chage -M 180 -W 5 -E 2004-12-31 sangjin sangjin

6

,

5 2004

12

.

31

.

5.1.5. pwconv : /etc/passwd

z

/etc/shadow

. z pwconv /usr/sbin/

,

.

/etc/passwd

/etc/shadow

.

/etc/passwd

/etc/shadow

pwconv

/etc/shadow

.

/etc/passwd

pwconv

/etc/shadow

/etc/shadow

. /etc/passwd . z

1. /etc/passwd

vipw

. vipw

/etc/passwd . z

2.

z

3. pwconv

vigr

/etc/shadow

/etc/group .

passwd

. z

4.

z

5. /etc/skel

.

- 8 -

.


.

chown chgrp

.

5.1.6. userdel :

z

.

z userdel [OPTIONS] accountname z

-r

.

5.1.7. chown :

z

.

z chown [OPTIONS] accountname FILES z

-R

.

) chown -r sangjin /home/sangjin /home/sangjin sangjin

.

5.2

. . GID

UID

- 9 -

.


student . , . 5.2.1. groupadd :

z

.

z groupadd -g GID groupname z

-r

. /etc/group .

groupname:passwd:GID:list of members ) professor:x:500: .

/etc/group

/etc/gshadow

. ,

. 5.2.2. groupdel :

z

.

z groupdel groupname 5.2.3. chgrp

- 10 -


:

z

.

z chgrp [OPTIONS] groupname FILES z

-R

.

5.3 5.3.1. who :

z . z

who [OPTIONS]

-m

whoami

.

) who sangjin

:0

Sep 20 19:31

sangjin

pts/0

Sep 20 19:31

who

, .

5.3.2. w :

z

. z w [OPTIONS] w

who

- 11 -

,


. ) w 22:29:46 up 3:00,

2 users, load average: 0.05, 0.23, 0.35

USER

TTY

FROM

LOGIN @IDLE JCPU

PCPU

WHAT

sangjin

:0

-

7:31

?

0.00s

2.58s

gnome-session

sangjin

pts/0 -

7:31

0.00s

2.91s

2.78s

hanterm

w

, ,

,

1 , 5 , 15

. . CPU

CPU

JCPU

tty

, PCPU

.

5.3.3. whoami :

z . z whoami

“id -un”

.

5.3.4. finger :

z

.

z finger [OPTIONS] [usernames] [username@host ...] z

-l finger

. /usr/bin

, .

- 12 -


1) finger Login

Name

Tty

Idle

Login Time

Office office Phone

sangjin

Kim Sangjin

:0

-

Sep 21 14:45 F207

041-560-1490

sangjin

Kim Sangjin

pts/0 -

Sep 21 14:45 F207

041-560-1490

2) finger -l Login: sangjin

Name: Kim Sangjin

Directory: /home/sangjin

Shell: /bin/bash

Office: F207, 041-560-1490 On since Sun Sep 21 14:45 (KST) on :0 (messages off) On since Sun Sep 21 14:52 (KST) on pts/0 No mail. No Plan.

- 13 -


:

.

- fg, bg, jobs, ps, top, kill, killall, pstree .

,

CPU . . (PID, Process IDentifier) .

.

1

.

6.1

. (foreground)

.

(background) . ‘&’ . . . , . 1) hanterm &

- 1 -


hanterm

. ,

“[1] 6369” . [1]

, 6369

. [Ctrl]+[z]

.

bg, fg

. bg , fg

2) [Ctrl]+[z]

.

bg .

6.1.1 jobs :

z

.

z jobs [OPTIONS] [JOBSPECS] z

-l

.

1)

. # xclock & [1] 1961 # xeyes & [2] 1962 # hanterm & [3] 1963 # jobs [1]

Running

xclock &

[2]-

Running

xeyes &

[3]+

Running

hanterm &

jobs

.

- 2 -


,

‘+’

, ‘-’

. 2) fg [JOBSPEC] fg . 2-1) fg . 2-2) fg 2 . 2-3) fg xeyes xeyes

.

xeyes .

‘%’

.

2-4) %+: 2-5) %-: 2-6) %n: n 2-7) %

,

xclock

.

: .

%x %xe

bg

fg .

6.1.2 ps :

z

%1

. z ps [OPTIONS]

- 3 -

xeyes

xclock %xeyes

.


z

-A, -e

. . .

-a a

. .

-u accountname -T

.

z

-f

(full listing)

. , CPU

u

. (wide output)

w

.

ps

.

1) ps w -f UID

PID

PPID

C

STIME

TTY

STAT TIME

sangjin 1917

1915

0

15:25

pts/0

S

00:00:02 -bash

sangjin 2065

1917

0

15:35

pts/0

S

00:00:00 xclock

sangjin 2066

1917

0

16:13

pts/0

R

00:00:00 ps -f

PPID: C: STIME: TTY: TIME: CPU

- 4 -

CMD


STAT: - D:

,

- R: - S: - T: - Z: zombie 1) ps uw UID

PID

%CPU %MEM VSZ

RSS TTY

STAT START TIME

CMD

sangjin 1917 0.0

0.2

5504

1460 pts/0 S

15:25

00:00:02 -bash

sangjin 2065 0.0

0.6

15212 3508 pts/0 S

15:35

00:00:00 xclock

sangjin 2066 0.0

0.1

2608

16:39

00:00:00 ps -f

644

pts/0 R

%CPU: CPU %MEM: VSZ: RSS: START: 6.1.3 top :

z

. z top [OPTIONS] top ,

10

.

6.1.4 kill z

:

.

z kill [OPTIONS] [PIDS] z

- 5 -


-s signal

signal

. .

-l 1) kill 2065 2065

SIGTERM

SIGTERM

(exit)

.

2) kill -9 2065 2065

9

(SIGKILL)

.

. 3) kill -s SIGHUP 2065 2065

SIGHUP

.

. 4) kill -3 2065 2065

3

(SIGQUIT) core

. .

5) kill -9 -1 -1 . 6.1.5 killall :

z

. z killall [OPTIONS] [NAMES] z kill ) killall xeyes xeyes

xeyes

.

- 6 -

SIGTERM

.


6.1.6 pstree :

z

.

z pstree [OPTIONS] [PID|USER] z

-a

. .

-p

1) pstree -ap 1917 bash, 1917 |-pstree, 2078 -ap 1917 `-xclock, 2065 1917

.

- 7 -


:

.

-

, ext3

- /etc/fstab, /etc/mtab - inode - sync, ln, stat, fsck, df, du, fdisk, mount, unmount 7.1 ( )

,

.

, . .

. , . ext2 .

.

,

. .

sync . (journaling) .

, .

- 1 -


.

append .

.

. ext3

ext2

7.1.1 /etc/fstab

.

/etc/mtab /dev/hdXN

/dev/sdXN sdXN

. hdXN

SCSI

EIDE

,

. X

a

. N

.

/dev/hda1

. /etc/fstab . LABEL=/

/

ext3

defaults

1 1

LABEL=/boot

/boot

ext3

defaults

1 2

none

/dev/pts

devpts

gid=5,mode=620

1 1

LABEL=/home

/home

ext3

defaults

1 2

none

/proc

proc

defaults

0 0

none

/dev/shm

tmpfs

defaults

0 0

LABEL=/var

/var

ext3

defaults

1 2

/dev/hda5

/swap

swap

defaults

0 0

/dev/cdrom

/mnt/cdrom

iso9660 noatuo,owner,kudzu,ro

0 0

/dev/fd0

/mnt/floppy

auto

0 0

noauto,owner,kudzu . .

“none”

.

, “fsck /dev/hda1”

.

“fsck /”

,

.

.

suid, dev, exec, auto, nouser, async rw

“defaults”

rw,

. , suid

setuid

setgid

. exec

, auto

“mount -a”

. nouser , async

- 2 -


. CD-ROM

noauto .

. CD-ROM

ro

. . .

. /etc/mtab

. . /dev/hda6

/

ext3

rw

0 0

none

/proc

proc

rw

0 0

usbdevfs

/proc/bus/usb

usbdevfs

rw

0 0

/dev/hda1

/boot

ext3

rw

0 0

none

/dev/pts

devpts

rw,gid=5,mode=620

0 0

/dev/hda2

/home

ext3

rw

0 0

none

/dev/shm

tmpfs

rw

0 0

/dev/hda3

/var

ext3

rw

0 0

7.2 . . 7.1

.

. (/):

z .

. z /bin

. :

. .

z /boot

:

- 3 -


/

/boot

/usr/bin

/usr/local/bin

/dev

/usr/include

/usr/local/etc

/etc

/usr/lib

/usr/local/lib

/proc

/usr/local

/usr/local/sbin

/opt

/usr/sbin

/usr/local/src

/lib

/usr/share

/bin

/usr/src

/usr/share/man

/sbin /usr /root

/var/adm

/home

/var/log

/tmp

/var/spool

/var

/var/tmp

<

7.1>

.

, .

1024

.

z /dev

:

(device driver)

.

. . z /etc

:

. /etc/passwd

. .

z /home

:

.

. z /lib

:

- 4 -


. z /lost+found

:

, z /mnt

. : CD-ROM .

CD-ROM

/mnt/floppy z /proc

/mnt/cdrom ,

.

:

. PID . .

z /root

:

z /sbin

:

root

.

. z /tmp

: .

. .

z /usr

: .

z /var

X

/usr/X11R6

.

:

. , , .

7.3

- 5 -


, inode(index node)

.

inode

inode

.

inode .

ls

inode

. 3

.

. “ls -l”

“-rw-r--r--”

.

. ‘-’ .

, ‘d’

c

‘l'

, b .

7.3.1 ,

.

. .

,

chmod

,

r, w, x

, 8

.

. (stick bit):

z ,

,

.

/tmp

.

1) drwxrwxrwt 11 root root 300 2

19 2003 /tmp

drwxrwxrwx .

drwxrwxrwt ,

,

.

“chmod o+t AAA”

“chmod 1755”

. (setuid),

(setgid)

. . 2) -rwsr-xr-x

1

root root 95564 2

- 6 -

19 2003 su


<

7.2>

,

,

su

x

s

.

. .

“chmod u+s AAA”

“chmod 4755” , “chmod g+s AAA”

“chmod 2755” .

7.3.1 . link)

(hard link)

(symbolic

. . .

,

,

.

.

0

.

inode .

7.2

.

ln

.

- 7 -

,

,


7.3.2 ln :

z

.

z ln [OPTIONS] source [dest] ln [OPTIONS] [SOURCES] DIR z

-l

. .

-b

.

-f ln . AAA

/AAA/BBB/c

ln

BBB .

1) ln -s /bin . ‘-s’

.

2) ln AAA BBB AAA

BBB

. “ls -l” .

3) ln /home/sangjin/AAA /home/john/ john

, /home/sangjin

cd

. .

sangjin

john

AAA

AAA

sangjin

john sangjin

. .

- 8 -

/home/john

AAA

AAA . AAA

john john


7.3.3 stat :

z . z

stat [OPTIONS] FILES z

-f

.

1) stat / FILE:

`/'

SIZE:

4096

Blocks: 8

IO Block: 4096 Directory

Device:

806h/2054d

Inode: 2

Links: 20

Uid: ( 0/ root)

Gid: ( 0/ root)

Access: (0755/dwrxr-xr-x)

Access: 2003-10-03 16:09:07.0000000000 +0900 Modify:

2003-10-03 16:08:25.0000000000 +0900

Change: 2003-10-03 16:08:25.0000000000 +0900 7.3.4 fsck :

z

.

z fsck [OPTIONS] FILESYSTEMS z

-a -A

. /etc/fstab

. .

-t filetype fsck

umount

- 9 -


. 7.4 7.4.1 df :

z . z

df [OPTIONS] [FILESYSTEMS] z

-a

0

. .

-h type

-t type

.

) df -h -t ext3 Filesystem

Size

Used

Avail

Use%

Mounted on

/dev/hda6

4.4G

2.4G

1.8G

58%

/

/dev/hda1

99M

9.3M

85M

10%

/boot

/dev/hda2

3.0G

36M

2.8G

2%

/home

/dev/hda3

2.0G

83M

1.8G

5%

/var ext3

. 7.4.2 du z

: .

z du [OPTIONS] [FILES] z

- 10 -


-h

. .

-s n

--max-depth=n

.

1) du -h -s /home/sangjin 3.5M /home/sangjin

3.5M

. 2) du -h --max-depth=1 /home 16K

/home/lost+found

3.5M

/home/sangjin

48K

/home/john

3.6M

/home

7.5 . 1.

.

2. fdisk

.

3. mkfs

.

4. mount

.

7.5.1 mkfs z

:

.

z mkfs [OPTIONS] DEVICE z

- 11 -


-c

. .

-t type

) mkfs -t ext3 /dev/hdb1 ext3

.

“mkfs.ext3 /dev/hdb1”

.

7.5.2 mount :

z

.

z mount -a [OPTIONS] mount [OPTIONS] DEVICE MOUNT-POINT z

-a

/etc/fstab

. .

-t type ,

-o option

.

) mount -t iso9660 /dev/cdrom /mnt/cdrom CD-ROM

.

7.5.3 unmount :

z . z

unmount -a [OPTIONS]

- 12 -


unmount DEVICE|MOUNT-POINT 1) unmount /mnt/cdrom 2) unmount /dev/cdrom 1

, .

- 13 -

2


8.

,

,

:

, ,

.

- which, whereis, locate, find, diff, ex, gzip, gunzip, tar 8.1 8.1.1 which :

z

PATH .

z which FILES 1) which gcc : /usr/bin/gcc . PATH

.bash_profile

. .bash_profile

/sbin

PATH

PATH=$PATH:$HOME/bin

. PATH=$PATH:$HOME/bin:/sbin 8.1.2 whereis z

:

, .

z whereis [OPTIONS] FILES

- 1 -

, man


z

-b

.

-s

.

-m

man

.

1) whereis gcc : gcc: /usr/bin/gcc /usr/share/man/man1/gcc.1.gz 8.1.3 locate :

z

. z locate [OPTIONS] PATTERNS

. locate

which, whereis . .

updatedb .

, /tmp .

updatedb

.

8.1.4 find z

: .

z find [PATHS] [expression] expression

OPTION

- 2 -

.

,


z

-amin n

n

-atime n

n n

-ctime n 0

-empty

n

-gid n

gname

-group gname -mmin n

n

-mtime n

n pattern

-name pattern

mode

-perm mode

n

-size n[bckw] -type c

c -

: b, c, d, p, f(

), l, s

n

-uid n uname

-user uname

which find

.

1) find / -name passwd -user root passwd

root .

2) find /home/sangjin -empty -type f 0

/home/sangjin

.

- 3 -

,


3) find / -perm 777 -type d 777 . 8.2 8.2.1 diff :

z

.

z diff [OPTIONS] [FILES] z

-b -e

. ex

. .

-i

.

-q

.

-r diff . 1)

, 1.txt

2.txt

Monkey

monkey

lion

lion tiger

“diff 1.txt 2.txt”

“diff 2.txt 1.txt”

.

- 4 -


diff 1.txt 2.txt

diff 2.txt 1.txt

1c1

1c1

< Monkey

< monkey

---

---

> monkey

> Monkey

2a3

3d2

> tiger

< tiger

, 1c1 , 2a3 . 3d2 . 2)

1

“diff -e 1.txt 2.txt > change”

change

. change

change-w

2a

2a

tiger

tiger

.

.

1c

1c

monkey

monkey

.

. w

w change-w”

change-w 1.txt

, “ex - 1.txt < 2.txt

8.3 8.3.1 gzip z

:

.

z gzip [OPTIONS] [FILES]

- 5 -

.


z

.

-d

gunzip

. .

-l gzip

GNU

.

1) gzip 1.txt 1.txt

,

1.txt

1.txt.gz

. 8.3.2 gunzip :

z

.

z gunzip [OPTIONS] [COMPRESSED FILES] 1) gunzip 1.txt.gz “gzip -d 1.txt.gz”

.

gzip bzip2

.

. compress

bzip2

“.bz2” .

8.3.3 tar z

: .

z tar [OPTION] FILES|DIRS

- 6 -

compress, “.Z”

. bzip2

gzip

,


z

-c

archive archive

-x

. . .

-v archive

-f archive -t

archive

-z

gzip

. .

1) tar cvf sangjin.tar /home/sangjin /home/sangjin

sangjin.tar

2) tar xvf sangjin.tar sangjin.tar

archive

.

3) tar tvf sangjin.tar sangjin.tar

archive

,

.

- 7 -

archive

.


9. : . - which, whereis, locate, find, diff, ex, gzip, gunzip, tar - /etc/sysconfig 9.1 CPU 9.1.1 uname :

z

. z uname [OPTIONS] z

-s

. .

-n .

-r -v

. .

-m -p

.

-i

.

-o

. .

-a

- 1 -


1) uname -a Linux crypto 2.4.20--8 ... i686 i686 i386 GNU/Linux 9.2 9.2.1 free :

z

.

z free [OPTIONS] z

. -k

-m

, -b

.

-o

/

-s n

.

n

.

1) free -mo total

used

free

shared buffers cached

Mem:

501

157

344

0

Swap:

509

0

509

22

65

9.3 6

ps

.

pstree

. pstree

ps . . 9.4 7

df

- 2 -


,

du

/etc/fstab

.

/etc/mtab

, ,

.

9.5 9.5.1 /etc/sysconfig/hwconf /etc/sysconfig/hwconf .

kudzu

. ,

/etc/sysconfig/hwconf

j

.

9.6 5

/etc/passwd

, finger who

.

w

.

9.7 netstat ifconfig

.

10

.

9.8 9.8.1 date z

:

.

z date [OPTIONS] date MMDDhhmm[[CC]YY][.ss]

- 3 -


1) date 2003. 10. 17. ( ) 21:51:32 KST 2) date 12250930 12

25

9

30

.

3) date 010713152004.30 2004

1

7

1

15

30

.

9.8.2 clock . ,

. .

.

date

,

clock

. “clock -w” .

9.9 /etc/sysconfig z /etc/sysconfig/authconfig shadow , MD5

.

authconfig MD5

.

/etc/sysconfig/authconfig

shadow

.

USEMD5=yes USESHADOW=yes MD5

Kerberos, LDAP, SMB

.

z /etc/sysconfig/clock . .

/etc/sysconfig/clock

- 4 -

ZONE

ZONE .


ZONE="Asia/Seoul" z /etc/sysconfig/desktop X .

GNOME

.

DESKTOP="GNOME" z /etc/sysconfig/desktop X .

GNOME

.

DESKTOP="GNOME" z /etc/sysconfig/harddisks DMA

, EIDE 32 .

. z /etc/sysconfig/i18n . . LANG="ko_KR:eucKR" z /etc/sysconfig/keyboard . .

- 5 -


KEYBOARDTYPE="pc" KEYTABLE="us" PC

KEYBOARDTYPE us

pc

,

.

z /etc/sysconfig/mouse . ,

. 10

- 6 -

.


10. : . - quota, quotacheck, edquota, repquota - aquota.user, aquota.group

. . 10.1 10.1.1 (quota) .

. usrquota

grpquota

.

/etc/fstab

.

/home . LABEL=/home

/home

ext3

defaults,usrquota

1 2 .

“-o remount” . 10.1.2

- 1 -


. . 1.

z

aquota.user 600

,

.

# touch aquota.user # chmod 600 aquota.user aquota.group

.

2. quotacheck

z

.

# quotacheck -a -m . 3. edquota

z

.

# edquota sangjin vi

.

Disk quotas for user sangjin (uid 500) Filesystem

blocks

soft

hard

inodes

soft

hard

/dev/hda2

3576

0

0

515

0

0

blocks inode

, inodes .

blocks

inodes

soft

hard .

0

. soft

,

, hard . 150,000 100MB

blocks

soft

100,000

hard

sangjin ,

150MB

.

1

100MB

,

100MB .

10.1.3 quotaon

.

# quotaon /home quotaoff

- 2 -

.


# quotaoff /home 10.2 10.2.1 quota :

z

. z quota [OPTIONS] [uname|gname] z

-g

.

-u

. (

)

1) quota -u sangjin Disk quotas for user sangjin (uid 500) Filesystem blocks quota /dev/hda2

3576

limit

grace files

100000 150000

515

sangjin

quota

limit

0

0

grace

. ‘-u'

“quota sangjin”

sangjin

.

2) quota -g sangjin Disk quotas for group sangjin (uid 500): none sangjin

.

10.2.2 repquota :

z . z

repquota [OPTIONS] [FILESYSTEMS]

- 3 -


z

-a

/etc/mtab . .

-g

. (

-u

) .

-s 1) repquota -a . 2) repquota -g /home /home

.

10.2.3 quotacheck :

z

. z quotacheck [OPTIONS] [FILESYSTEMS] z

-a

/etc/mtab

. .

-b

-m . .

-c

- 4 -


quotacheck

quotaoff

,

. 10.2.4 quotaon, quotaoff :

z . z

quotaon [OPTIONS] FILESYSTEMS quotaoff [OPTIONS] FILESYSTEMS z

/etc/fstab

-a

/

. /

-u

. (

/

-g

)

.

10.2.5 edquota :

z

. z edquota [-p uname] [-ug] UNAMES|GNAMES z

-p uname

.

-u

. (

-g

.,

- 5 -

)


1) edquota -p sangjin john john

sangjin

.

2) edquota -p sangjin `awk -F: '$3>499 {print $1}' /etc/passwd` /etc/passwd sangjin

499 .

- 6 -


11. : . - crontab, at - /etc/crontab, /etc/anacrontab, /etc/cron.allow, /etc/cron.deny, /etc/at.allow, /etc/at.deny - /etc/cron.hourly, /etc/cron.daily, /etc/cron.weekly, /etc/cron.monthly

.

cron

.

crond

,

. .

at

.

11.1 cron cron

/etc/crontab

/etc/cron.hourly, /etc/cron.daily, /etc/cron.weekly,

/etc/cron.monthly

. ,

cron

.

11.1.1 /etc/crontab /etc/crontab (0-59) ,

.

(0-23)

,

,

(1-31)

(1-12)

(0-6,0

,

.

- *: -

)

: ‘-’

: ‘,’

:

- 1 -


/etc/crontab 01 *

.

*

*

*

root

run-parts /etc/cron.hourly

02 4 *

*

*

root

run-parts /etc/cron.daily

22 4 *

*

0 root

run-parts /etc/cron.weekly

*

run-parts /etc/cron.monthly

42 4 1 *

root

. root

1

, .

4 (0) 4

,

1

01

0

*

0,30

*

13 *

4

*

42

run-parts /etc/cron.hourly

2

run-parts /etc/cron.daily

22

run-parts /etc/cron.weekly

run-parts /etc/cron.monthly

1-5

root

run-parts /etc/cron.daily

*

root

run-parts /etc/cron.monthly 12

,

13

30

1

.

run-parts /etc/cron.daily

run-parts /etc/cron.monthly

. 11.1.2

crontab

“crontab -e”

. vi

, /etc/crontab

vi

“ /var/spool/cron

. crond ,

.

cron

“crontab -l” “crontab -r”

1) crontab -e 0 0 * * * (cd /home/sangjin; du -s)

- 2 -

, .


“crontab -e”

12 /home/sangjin . crontab

.

“crontab -u sangjin -r” 11.1.3 /etc/cron.allow

sangjin

crontab

.

/etc/cron.deny

/etc/cron.allow

/etc/cron.deny

cron

. cron.allow cron

.

cron.deny cron

.

/etc/cron.deny

/etc/cron.allow

.

11.2 at cron

at . at

atd

. “at . . z [HH[:MM] [[AM|PM]|midnight|noon|teatime]] [MMDDYY|MM/DD/YY|MM.DD.YY|monthname day|today|tommorrow] [+ count minutes|hours|days|weeks] 1) at 10:55 2) at 10:55 102703 3) at 10:40PM today 4) at 10:55 oct 27 5) at 12pm + 3 days teatime

4

.

- 3 -


z now + count minutes|hours|days|weeks ,

,

,

. ) at now + 10 minutes 10

. “at>”

.

. [Ctrl]+[d]

.

“at -l”

,

.

“atq”

“atrm at

.

.

cron

/etc/at.allow

/etc/at.deny

at

. 11.3

anacron

anacron

cron

.

cron

anacron .

24

. anacron

/etc/anacrontab

,

.

/etc/anacrontab

.

1

65

cron.daily

run-parts /etc/cron.daily

7

70

cron.weekly

run-parts /etc/cron.weekly

30

75

cron.monthly

run-parts /etc/cron.monthly

1

(

) “run-parts /etc/cron.daily” 65

- 4 -

(


)

.

- 5 -


12. :

.

- /var/log, /etc/logrotate.d - syslogd, klogd - logrotate - /etc/syslog.conf, /etc/sysconfig/syslog, /etc/logrotate.conf - last, lastlog

. , . 12.1 /var/log syslogd .

/var/log

,

. 12.1

.

. . wtmp

lastlog , lastlog

, wtmp lastlog

last .

1) last sangjin

pts/0

Mon Oct 27 17:35

still logged in

2) lastlog -u sangjin sangjin

:0

10

27

12.2 syslogd

- 1 -

17:35:55 +0900 2003


<

12.1> /var/log

messages secure

xinetd

boot.log

rc

dmesg wtmp

login

lastlog

login

cron

cron

maillog

sendmail

cron

sysklogd klogd

.

syslogd

, klogd syslogd

, syslogd

/dev/log

/etc/syslog.conf

, . syslogd

/var/run/syslogd.pid syslogd

.

.

syslogd

. # kill -HUP `/bin/cat /var/run/syslogd.pid` syslogd

/etc/syslog.conf

. .

. (facility).

(severity level)

(action)

, .

,

- 2 -


<

12.2> syslogd

auth authpriv cron

cron, at

daemon ftp

ftpd(

)

kern local0 - local7 lpr mail

sendmail timestamp

mark news syslog

syslogd

user uucp

uucp

(

) , .

,

kernel, syslogd

(user) 12.2

.

syslogd

.

priv, authpriv

. mark .

‘*’

mark

. ,

.

- 3 -


<

12.3>

7

debug

6

info

5

notice

4

warning

3

err

2

crit

1

alert

0

emerg 8

, .

mail.warning

mail.warning, mail.notice, mail.info,

mail.debug, *.warning, *.notice, *.info, *.debug .

8

12.3 none

,

‘*’ ‘=’

‘!’

. .

,

.

12.4

.

. :

z

. . :

z .

. :

z

. .

) sangjin,john

‘*’

- 4 -


<

12.4>

daemon.info

info

daemon.=warning

warning

daemon.debug;daemon.!err

daemon.debug;daemon.!=notice

. .

debug, info, notice, warning . notice .

. :

z . ,

IP ‘@’

.

) @www.kut.ac.kr syslogd

-r

. syslogd /etc/sysconfig/syslog

.

/etc/syslog.conf

.

*.emerg

* emerg

. *.info;mail.none;authpriv.none;cron.none

/var/log/messages

mail, authpriv, cron

info

info

/var/log/messages

- 5 -

.


<

12.5> syslogd

syslogd cron

cron

info

ftpd

ftp

debug - crit

login

authpriv

info - err

lpd

lpr

info - err

passwd

auth

notice, warning

popper

local0

debug, notice

pop3

sendmail

mail

debug - alert

sendmail

shutdown

auth

notice

su

auth

notice

sudo

local2

notice, alert

syslogd

syslog,mark

info - err

vmlinuz

kern

all

xinted

configurable

info

UID su ,

. . syslogd

/etc/syslog.conf

.

/etc/init.d/syslog restart 12.3 syslogd syslogd

12.5

12.4 logrotate

- 6 -

.


<

12.6> logrotate

compress

. .

create .

daily, weekly, monthly delaycompress

.

errors

. .

missingok

.

notifempty dir

olddir dir

.

prerotate script .

endscript postrotate script

.

endscript5 sharedscripts

. n

rotate n

. n+1

. logsize

size=logsize

. . , .

logrotate

.

cron /etc/logrotate.conf

- 7 -

. ,

logrotate


. logrotate 12.6

.

/etc/logrotate.conf

, .

/etc/logrotate.d . { } )

/etc/syslog.conf

wtmp

.

/var/log/wtmp{ monthly create 0644 root utmp rotate 1 } wtmp

, /var/log

utmp

. wtmp /var/run

. wtmp utmp .

- 8 -


13. TCP/IP :

TCP/IP

.

- TCP/IP - ARP , IP

-

,

,

,

- /etc/sysconfig/network, /etc/sysconfig/network-script/ifcfg-

, /etc/host.conf,

/etc/hosts, /etc/resolv.conf, /etc/services - netconfig, ifconfig, netstat, hostname, arp, route, nslookup

.

TCP/IP(Transmission Control Protocol/Internet Protocol) (protocol suite)1) .

13.1 TCP/IP TCP/IP

13-1

(transport

(application layer),

layer),

(network

(host-to-network layer)

layer),

.

(physical layer)

-

(link layer)

. , TCP

Protocol)

-

UDP(User Datagram

. TCP , UDP

. TCP , UDP

.

UDP

. (packet)

. .

.

HTTP(HyperText Transport Protocol) SMTP(Simple Mail Transport Protocol) .

1)

- 1 -

,


application layer

HTTP, FTP

DNS

TCP

UDP

transport layer

IP

network layer

ARP, Device drivers

link layer

UTP, optical fiber, Radio

physical layer <

13-1

ICMP

13-1> TCP/IP

TCP/IP .

ICMP(Internet Control Message Protocol)

,

,

Resolution Protocol)

IP . ARP(Address

IP

.

(segment)

,

(frame)

. . .

13-2

.

Ethernet header

IP header

UDP header

Application Layer

Ethernet CRC

14 bytes

20 bytes

8 bytes

100 bytes

4 bytes

UDP packet (108 bytes) IP packet (128 bytes) Ethernet frame (146 bytes)

<

13-2>

- 2 -


IP

20

,

60

.

IP

. . TCP/IP .

z MAC(Medium Access Control)

(

)

IP

z z

(

)

MAC

. Ethernet

6

.

6

. ,

3

3

. MAC

ifconfig

,

3 .

http://www.cavebear.com/CaveBear/Ethernet/vendor.html IP ,

. IP IP

4

.

, IP IP

. IP

. IP .

4

IP

, .

IP DNS

IP

. .

. (port)

. . ,

23 , SMTP

16

, /etc/services 25

, HTTP

. 80

FTP .

- 3 -

21 , TELNET


13.1.1 TCP/IP .

IP

. netstat -t TCP

, netstat -u

UDP

.

13.1.2 IP IP

. , . IP

(netmask)

. IP

127 ,

(loopback)

127.0.0.1

. .

IP

.

<

A

1-126

N.H.H.H

B

128-191

N.N.H.H

C

192-223

N.N.N.H

D

224-239

E

240-255 0

13.1> IP

224

126 (0

)

216

214 (10

) 221

256 (110

IP

)

, 127

.

- 4 -


IP

. 13.1

.

.

IP .

CIDR(Classless InterDomain Routing)

.

. 166.104.0.0

B

A

, B .

4096

166.104.0.0 4096

, C

1024

166.104.7.255

A

. B

4096 , 166.104.16.0

1024

2048

166.104.8.0 166.104.31.255

166.104.8.0

. C

166.104.11.255

.

255.255.248.0, 255.255.240.0, 255.255.252.0

,

166.104.0.0/21, 166.104.16.0/20, 166.104.8.0/22

.

‘/’ .

. A

166.104.0.0/21

166.104.0.0

21

, 32-21=11

A

166.104.7.255 2046

2 =2048 2048

, 166.104.0.0

.

.

0 .

,

.

11

1

0

1

.

13.2 . z . . http://hardware.redhat.com . . lsmod

- 5 -


. z IP

,

, DNS .

,

.

netconfig

ifconfig

, ifconfig

.

/etc/init.d/network ,

. ,

.

,

/etc/sysconfig/network

/etc/sysconfig/network

.

NETWORK=yes HOSTNAME=crypto GATEWAY=220.70.68.254 /etc/sysconfig/network-script/ifcfg/etc/sysconfig/network-script/ifcfg-eth0

. .

DEVICE=eth0 BOOTPROTO=none BROADCAST=220.68.70.255 IPADDR=220.68.70.131 NETMASK=255.255.255.0 NETWORK=220.68.70.0 ONBOOT=yes USECTL=no PEERDNS=no GATEWAY=220.68.70.254 TYPE=ethernet BOOTPROTO

.

none

BROADCAST,

IPADDR, NETMASK, NETWORK IP

. BOOTPROTO

- 6 -

dhcp

DHCP .


ONBOOT

.

ifconfig

.

ifconfig

IP [NETMASK] [BROADCAST] up|down up

,

down

. 13.2.1 IP

IP MAC

. IP

MAC

ARP(Address Resolution Protocol)

.

A A

B

ARP

B

MAC

. B

. ARP cache ARP

.

. ARP MAC

.

arp

.

.

route

. . :

z

.

. :

z . , .

- 7 -


127.0.0.0

z

:

,

. : default

z , . route

.

Destination

Gateway

Genmasks

Flags Metric Ref Use Iface

220.68.70.0

*

255.255.255.0

U

0

0 0

eth0

127.0.0.0

*

255.0.0.0

U

0

0 0

lo

default

220.68.70.254

0.0.0.0

UG

0

0 0

eth0

220.68.70.0 . 127.0.0.0 . . netstat -rn 13.3

route

.

IP IP . .

IP

/etc/host.conf

/etc/host.conf

.

order hosts,bind /etc/hosts

IP DNS

/etc/hosts

.

.

127.0.0.1

crypto

localhost.localdomain

220.68.70.131

crypto.kut.ac.kr

/etc/hosts

localhost

DNS

- 8 -


,

localhost

. localhost

hostname DNS

.

/etc/resolv.conf

.

/etc/resolv.conf

. search kut.ac.kr nameserver 220.68.64.1 nameserver 203.255.221.2 search

nameserver

. search DNS

www.kut.ac.kr

www

.

search

. nameserver

DNS

,

DNS .

DNS

nslookup

. , IP

exit

. .

IP nslookup nslookup

- 9 -

.


14. : . - ping, traceroute, netstat, tcpdump (sniffering)

-

. , . 14.1 ping :

z

. z ping [OPTIONS] HOST z

-c count

ECHO_RESPONSE

-i wait

wait

. .

.

-R ping

ECHO_RESPONSE ECHO_REQUEST

ICMP

. , .

. ping .

1

, ping .

- 1 -

.


1) ping -c 3 www.kut.ac.kr PING kutwww.kut.ac.kr (220.68.64.4) 58(84) bytes of data 64 bytes from 220.68.64.4: icmp_seq =1 ttl=254 time=4.01 ms 64 bytes from 220.68.64.4: icmp_seq =2 ttl=254 time=0.350 ms 64 bytes from 220.68.64.4: icmp_seq =3 ttl=254 time=0.350 ms --- kutwww.kut.ac.kr ping statistics --3 packets transmitted, 3 received, 0% packet loss, time 2025ms rrt min/avg/max/mdev = 0.350/1.572/4.016/1.728 ms www.kut.ac.kr

ping

. ttl(time to live)

IP router

,

60 .

. ping

ttl

ping

TCP/IP

255 TCP/IP

. .

icmp_seq

ttl

254

. ping ttl

, (

),

TCP/IP

255 60

. ping

.

2) ping -c 2 -R www.kut.ac.kr PING kutwww.kut.ac.kr (220.68.64.4) 58(84) bytes of data NOP RR:

220.68.70.132 220.68.64.254 220.68.64.4 220.68.70.254 220.68.70.132

--- kutwww.kut.ac.kr ping statistics --1 packets transmitted, 1 received, 0% packet loss, time 0ms rrt min/avg/max/mdev = 36.446/36.446/36.446/0.000 ms ‘-R’

30

ping

.

- 2 -


14.2 traceroute :

z . z

traceroute [OPTIONS] HOST z

-d -m maxhop -n

. . 30

.

DNS

. .

-w waittime traceroute

UDP

(probe packet) .

ttl

ping

1 . ttl

0 time exceed

.

. .

‘*’ ttl

3

.

‘*’

. (firewall)

ICMP ECHO_RESPONSE

,

.

time exceed ‘*’

. 1) traceroute www.mic.go.kr traceroute to web.mic.go.kr (203.254.110.10), 30 hops max, 38 bytes packets 1. 220.68.70.254 (220.68.70.254) 20.847 ms 23.516 ms 17.339 ms 2. * * * ...

- 3 -


14.3 netstat :

z

.

z netstat [OPTIONS] HOST z

-ei

ifconfig

-r

route

. . .

-s . -

(ifconfig

-

(route

)

)

1) netstat Proto Recv-Q Send-Q Local Address

Foreign Address

State

... tcp

0

0

220.68.70.131:telnet 220.68.70.132:34858

ESTABLISHED

...

TCP UDP

.

220.68.70.131

220.68.70.132

telnet

TCP

.

. UDP . TCP

.

- ESTABLISHED: - SYN_SENT: - SYN_RECV: - CLOSED: - TIME_WAIT: - LISTEN:

- 4 -


2) netstat -ei Kernel Interface table eth0

Link encap: Ethernet HWaddr 00:50:04:FD:8C:FD UP BROADCASTING RUNNING MULTICAST MTU: 1500 Metric: 1 RX packets: 118287 errors: 2 dropped: 2 overruns:0 frame: 0 TX packets: 430 errors: 0 dropped: 0 overruns: 0 carrier: 0 collisions: 0 txqueuelen: 100 RX bytes: 8833287 (8.4 Mb) TX bytes: 29914 (29.2 Kb) Interrupt: 3

netstat

Base Address: 0x300

“-ei”

ifconfig .

RX packets

, TX packets

. collision

, .

3%

, 10%

.

3) netstat -s ip: 111278 total packets received 0 forwarded 0 incoming packets discarded 98785 incoming packets delivered 99863 requests sent out ... ‘-s’

(IP, ICMP, TCP, UDP .

4) netstat -r netstat

“-r”

route

. 14.4 tcpdump z

:

.

z tcpdump [OPTIONS] EXPRESSION z

- 5 -

)


-vv

. .

-w -x

16

.

. . . . . . “promiscuous”

. .

. ) tcpdump -xvv -w sniffered.txt host infosec.kut.ac.kr infosec.kut.ac.kr sniffered.txt

.

- 6 -


15. : . - telnet, ssh, talk, write, mesg, whois, rpm .

. . .

15.1 telnet :

z . z

telnet [OPTIONS] HOST telnet [OPTIONS] HOST PORT (telnet) .

rlogin

.

telnet .

rlogin

16

. “exit”

.

. . .

MIT

Kerberos ,

ssh, telnet-ssl

. Kerberos

telnet

openssh .

- 1 -


15.2 ssh :

z

,

.

z ssh [OPTIONS] UNAME@HOST ssh [OPTIONS] UNAME@HOST PORT ssh ssh . openssh

rpm

.

. . . RPM(Redhat Package Manager) . RPM ,

, , . RPM . “.386.rpm”

“rpm -ivh”

,

“rpm -Uvh”

.

“rpm -e” ”

.

,

“rpm -qa | grep

.

openssh

.

rpm -qa | grep ssh openssh-3.5p1-6 openssh-server-3.5p1-6

- 2 -


openssh-clients-3.5p1-6 openssh-askpass-3.5p1-6 openssh-askpass-gnome-3.5p1-6 (standalone)

inetd

. . ssh

16

standalone

,

init

standalone . init

/etc/init.d

. ssh .

/etc/init.d/sshd status sshd (pid 1662)

..

status

start, stop, restart

,

,

. ssh

RSA

, ssh .

ssh

PuTTY

. .

http://fallin.lv/zope/pub/index_html/noriteo/putty 15.3 ftp :

z

. z ftp [OPTIONS] HOST ftp ftp

. ftp . . ftp

- 3 -


ftp

. anonymous ,

.

“ftp>”

.

ascii, binary, get, put, mget, mput, ls, cd, bye

. ascii

binary

, ,

ascii

binary

.

get put

,

. mget

mput

. 15.4 talk :

z

. z talk UNAME talk UNAME@HOST talk

talk

. talk

inetd

talk

, talk

/etc/xinetd.d

(ntalkd)

xinetd

.

16

. who

.

talk .

Message from Talk_daemon@crypto at 11:52 ... talk: connection requested by sangjin@crypto. talk: respond with: talk sangjin@crypto talk sangjin@crypto

, .

- 4 -


15.5 write :

z

. z write UNAME write

write .

Message from uname@host on tty at hh:mm ... , Ctrl+d

EOF

. mesg .

“mesg n”

,

“mesg y”

.

15.6 whois :

z . z

whois [OPTIONS] DOMAINNAME 1) whois kut.ac.kr [Querying whois.krnic.net] (WHOIS) query: kut.ac.kr # KOREAN : kut.ac.kr : ...

- 5 -

.


16. :

.

- standalone

inetd

- /etc/xinetd.d, /etc/init.d - /etc/xinetd.conf, /etc/xinetd.d - chkconfig standalone

inetd

. standalone

,

init

. inetd

inetd

, inetd .

inetd

,

standalone

inetd

.

xinetd(secure inetd)

.

16.1 inetd inetd

telnet, pop3, finger, ntalk

xinetd

standalone

.

, xinetd

/etc/xinetd.d

. xinetd

/etc/xinetd.conf

.

xinetd .

=, +=, -=

, =

, +=

, -= .

+=

. /etc/xinetd.conf

.

- 1 -

-=

defaults


defaults { instances

= 60

log_type

= SYSLOG authpriv

log_on_success = HOST PID log_on_failure

= HOST

cps

= 25 30

} includedir /etc/xinetd.d . z instances:

.

,

UNLIMITED

60

.

z log_type: xinetd

.

SYSLOG

authpriv

. xinetd . z log_on_success: xinetd . EXIT, DURATION

PID, HOST, USERID,

. PID

, HOST USERID

. USERID , EXIT

. DURATION .

z log_on_failure: xinetd . z cps:

,

25

.

, .

xinetd

xinetd.conf ntalkd

service ntalk{ flags

= IPv4

- 2 -

. .


disable

= no

socket_type

= dgram

wait

= yes

user

= nobody

group

= tty

server

= /usr/sbin/in.ntalkd

} . z flags:

,

INTERCEPT,

NORETRY, IDONLY, NAMEINARGS, NODELAY, KEEPALIVE, NOLIBWRAP, SENSOR, IPv4, IPv6 z disable: no

.

xinetd

,

xinetd

,

yes

.

z socket_type:

,

stream, dgram, raw, seqpacket stream

.

TCP

, UDP

dgram

. z wait:

, xinetd .

yes

xinetd

. no

xinetd

, . no

yes

TCP

, UDP

.

z user:

UID

z group:

.

GID

. .

z server: . z only_from:

.

z no_access:

.

z access_times:

, 09:00-17:00 .

- 3 -


16.2 standalone standalone

init

. /etc/init.d

,

ntsysv .

, /etc/init.d .

init

/etc/rc.d/rcx.d . ntsysv

.

/etc/init.d /etc/rc.d/rcx.d .

mysql

/etc/init.d

,

5 /etc/rc.d/rc5.d

/etc/rc.d/rc0.d

. # ln -s /etc/init.d/mysql /etc/rc.d/rc0.d/K16mysql # ln -s /etc/init.d/mysql /etc/rc.d/rc5.d/S20mysql chkconfig . # chkconfig --add mysql chkconfig

/etc/init.d .

# chkconfig: 2345 90 20 # description: 2, 3, 4, 5 20

90

.

- 4 -

,


17. : . - SMTP, IMAP, POP - sendmail alias

- sendmail - qpopper

(electronic mail) .

(spam)

.

. sendmail(http://www.sendmail.org) .

17.1 . :

z

. :

z

.

,

. SMTP

z

. : .

z

: . Access Protocol)

POP(Post Offfice Protocol)

- 1 -

IMAP(Internet Message .


(MUA, Mail User Agent): MIME(Multipurpose Internet Mail Extensions) .

/bin/mail

,

elm, pine

. outlook, Eudora . (MTA, Mail Transport Agent): sendmail

.

Exchange Server

.

sendmail

.

SMTP

. 25

.

(delivery agent): .

/var/spool/mail

/var/mail .

: . IMAP

POP

. (MSA. Message

Submission Agent)

.

. , . sendmail ,

587

25 MSA

.

- 2 -


.

MUA

SMTP

MSA

.

(/var/spool/clientmqueue) MTA

. MSA

. MTA

(/var/spool/mqueue)

. MTA

.

SMTP

MTA

. (/var/spool/mail)

POP

.

IMAP .

17.2 . :

z

, .

,

sendmail

.

:

z

RFC 2822 ,

,

,

, .

:

z

. .

17.2.1 . Return-Path: <jae@kut.ac.kr> Delivered-To: sangjin@kut.ac.kr Received: (qmail 20755 invoked from network); 28 Oct 2003 17:51:38 +0900(KST) Received: from unknown (HELO kutime) (220.68.70.127) by 0 with SMTP; 28 Oct 2003 17:51:38 +0900(KST) Message-ID: <003a01c39d31$29ccecc0$7f4644dc@kutime> From: =?ks_c_5601-1987?B?wMzA58f5?= <jae@kut.ac.kr> To: <sangjin@kut.ac.kr> Subject: =?ks_c_5601-1987?B?sLO/5A==?=

- 3 -

,


Date: Tue, 28 Oct 2003 17:54:57 +0900 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0036_01C39D7C.99A63CE0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2720.3000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2727.1300

To, From

‘:’

.

X

. . . Return-Path:

.

From

.

Delivered-To:

.

Received: .

KST(Korean Standard Time)

,

(UTC, Universal Coordinated TIme)

9

. Received .

sendmail .

qmail

Received

,

Received .

sendmail

Received

.

Received: from boldfish.ieee.org (boldfish [140.98.194.25]) by boldfish (8.9.3+Sun/8.9.3) with ESMTP id LAA14077 for <sangjin@kut.ac.kr>; Tue, 11 Nov 2003 11:27:29 -0500 (EST) sangjin@kut.ac.kr

boldfish.ieee.org

boldfish

.

LAA14077 8.9.3

.

boldfish

, EST

sendmail .

- 4 -


Message-ID:

, . .

From, To, Subject, Date .

Cc

. 17.3

, POP

IMAP

.

. z z z POP

z

IMAP

.

17-1

. IMAP

POP . POP

IMAP

, . ,

IMAP

.

pop3d

.

- 5 -

imapd

pop


alias

17.4

SMTP

SMTP

수신 서버 - 보안 강화 - 스팸 필터링 기능

전송 서버

-바이러스 필터링 기능

- 스팸 필터링 기능

clients

전자우편 저장소

POP/IMAP

SMTP

SMTP

패스워드의 암호화 <

MSA 서버

17.1>

alias .

, forwarding,

.

LDAP(Lightweight Directory Access Protocol) alias /etc/aliases .

alias

alias

newaliases

. sendmail

alias

. /etc/aliases

.

john: mary ime: sangjin,jae,jeong,hkyun,jaesoo27 john

mary sangjin, jae, jeong, hkyun, jaesoo27

.

/etc/passwd

- 6 -

, ime


john

mary

john

.

. /etc/alias .

infosec: :include:/etc/mail/compsec.aliases 17.4.1

forwarding

sendmail .forward

.

. infosec.kut.ac.kr

sangjin

.forward

.

sangjin@kut.ac.kr sangjin@infosec.kut.ac.kr

infosec.kut.ac.kr

sangjin@kut.ac.kr

.

17.5 sendmail sendmail SMTP

. sendmail

.

# /usr/sbin/sendmail =d0.1 -bt < /dev/null 17.5.1 sendmail sendmail

www.sendmail.org smmsp

UID

. GID

8.12

. smmsp

- 7 -


smmsp

. sendmail

. .

www.sleepycat.com

sendmail

. . z

1. www.sendmail.org sendmail.8.12.10.tar.gz

z

2. gunzip

. .

tar

.

# gunzip sendmail.8.12.10.tar.gz # tar xvf sendmail.8.12.10.tar z

3. sendmail . . # chmod go-w / /etc /etc/mail /usr /var /var/spool /var/spool/mqueue # chown root / /etc /etc/mail /usr /var /var/spool /var/spool/mqueue sendmail sendmail

.

# /usr/sbin/sendmail -v -bi z

4.

site.config.m4 devtools/Site

sendmail

. .

z

5. sendmail.8.12.10/

z

6. cf/cf

“sh Build”

. .mc

sendmail.mc

.

.

“sh Build sendmail.cf”

. sendmail.cf

sendmail

. sendmail .

/bin/mail

.

procmail . procmail

www.procmail.org

. procmail sendmail.mc

define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')

- 8 -

,


FEATURE(local_procmail,`',`procmail -t -Y -a $h -d $u') “MAILER(local)”

“MAILER(procmail)”

.

“/etc/init.d/sendmail restart”

sendmail

.

“telnet localhost 25” . .

define(`confMAX_MESSAGE_SIZE',`100000') : .

.mc

cf

. z

7.

z

8. cf/cf

/etc/mail/sendmail.cf

/usr/sbin/sendmail

.

“sh Build install-cf”

cf

. 9. /sendmail

z

“sh Build install-cf” sendmail

.

10. makemap, mailstats

z

sendmail

. 17.5.2 , smtp /var/spool/mqueue /var/spool/clientmqueue

.

, .

sendmail .

.

# /etc/init.d/sendmail stop # mv mqueue mqueue.tmp # mkdir mqueue # chown root mqueue # chmod 700 mqueue # /etc/init.d/sendmail start

- 9 -


sendmail

. .

# /usr/sbin/sendmail -oQ/var/spool/mqueue.tmp -q 17.5.3 sendmail z

3

. promiscuous relaying

z spam-friendly

z z libmilter

sendmail . . (relaying)

.

, . .

.

z ,

. , pop

imap

. ,

z . IP . sendmail.mc .

- 10 -


/etc/mail/relay-domains . . sendmail . sendmail.mc

.

FEATURE(`access_db') /etc/mail/access

.

.

,

,

, IP

,

OK, RELAY, REJECT, DISCARD, xxx message DISCARD

. REJECT

REJECT

DISCARD

.

/etc/mail/access

.

cyberspammer.com

550 Spam not accepted

220.68.70.129

RELAY

220.68.70.131

REJECT

badguy@yahoo.com

REJECT

cyberspammer.com . .

550

RFC821

220.68.70.129

220.68.70.129

.

To, From, Connect . /etc/mail/access sendmail

- 11 -


. # makemap hash /etc/mail/access < /etc/mail/access 17.6 qpopper POP3 qpopper

pop3

.

ftp://ftp.qualcomm.com/eudora/server/popper 4.0.5 z

1.

. qpopper

. qpopper

.

qpopper.4.0.5.tar.gz

.

# gunzip qpopper.4.0.5.tar.gz # tar xvf qpopper.4.0.5.tar z

2. qpopper.4.0.5/

“./configure”

z

3. “make”

z

4. “make install”

z

5. qpopper.4.0.5/samples/qpopper.xinetd

. .

, qpopper.4.0.5/samples/qpopper.config . # cp qpopper.xinetd /etc/inetd.d/pop3 # cp qpopper.config /etc/qpopper110.cfg z

.

6. xinetd . # telnet localhost 110

- 12 -

/etc/xinetd.d/pop3 /etc/qpopper110.cfg


18. : . - MySQL - Apache - httpd.conf, .htaccess - .htaccess - PHP - ldconfig (World Wide Web)

.

HTTP(HyperText Transfer Protocol)

HTML(HyperText Markup Language) ,

-

CERN (Tim Berners Lee) apache

www.apache.org

. ,

.

apache

PHP, MySQL

,

.

18.1 MySQL apache MySQL

. MySQL

www.mysql.com

. . z

1. www.mysql.com mysql-4.0.16.tar.gz

z

2. gunzip

. .

tar

.

# gunzip mysql-4.0.16.tar.gz # tar xvf mysql-4.0.16.tar

- 1 -


z

3.

mysql

mysql

.

# groupadd mysql # useradd -g mysql mysql z

4. mysql-4.0.16/

./configure

.

# ./configure --with-charset=euc_kr . . # ./configure --prefix=/usr/local/mysql --with-charset=euc_kr --enable-assembler z

5.

make .

# make z

6.

make install .

# make install z

7. mysql-4.0.16/scripts/

mysql_install_db .

# ./scripts/mysql_install_db MySQL

mysql .

test

mysql

,

. z

8.

.

# chown -R root /usr/local/mysql # chown -R mysql /usr/local/mysql/var # chgrp -R mysql /usr/local/mysql z

9. Perl

MySQL

www.mysql.com .

DBI-1.38.tar.gz DBD-mysql-2.9003.tar.gz , DBI # tar xvfz DBI-1.38.tar.gz # cd DBI-1.38.tar.gz # perl Makefile.PL # make # make test

- 2 -

.


# make install DBD

.

# tar xvfz DBD-mysql-2.9003.tar.gz # cd DBD-mysql-2.9003 # perl Makefile.PL --cflags=-I/usr/local/mysql/include/mysql "--libs=-L/usr/local/mysql/lib/mysql -lmysqlclient" # make # make test # make install 10.

z

MySQL .

# cp ./support-files/mysql.server /etc/init.d/mysql init

MySQL

# chmod 755 /etc/init.d/mysql # chkconfig --add mysql /etc/rc.d/rcx.d . 11.

z

MySQL

/etc/ld.so.conf

,

/usr/local/mysql/lib/mysql ldconfig

.

# vi /etc/ld.so.conf # ldconfig 12.

z

.

# /usr/local/mysql/bin/mysqld_safe --user=mysql & # /usr/local/mysql/bin/mysqladmin version # /usr/local/mysql/bin/mysqladmin variables # /usr/local/mysql/bin/mysqladmin -u root shutdown # /usr/local/mysql/bin/mysqld_safe --log & # /usr/local/mysql/bin/mysqlshow # /usr/local/mysql/bin/mysqlshow mysql MySQL PATH

l

.bash_profile

/usr/local/mysql/bin

- 3 -

, MANPATH


.

.bash_profile

PATH

.

PATH = $PATH:$HOME/bin:.:/usr/local/mysql/bin MANPATH = /usr/share/man:/usr/local/man:/usr/local/mysql/man export PATH MANPATH ‘.’

PATH

. MySQL . # mysql mysql mysql> DELETE FROM user WHERE Host='localhost' AND User=''; mysql> update user set password = password('

') where user = 'root';

mysql> flush privileges; mysql> quit update SQL password

grant

, set .

mysql> set password for root@localhost = password('

‘);

mysql> grant usage on *.* to root@localhost identified by '

'

insert, update, set password grant

password()

password()

.

. z

1. MySQL

.

# /etc/init.d/mysql stop z

2. MySQL

“--skip-grant-tables”

.

# /usr/local/mysql/bin/mysqld_safe --skip-grant-tables --log & z

3. MySQL

.

- 4 -


zeroboard . # mysql -u root -p mysql> create database bbs; mysql> grant all privileges on bbs.* to bbsadmin@localhost identified by ' '; mysql> quit grant

insert

. mysql> INSERT INTO user (Host,User,Password) mysql> VALUES ('%','bbsadmin',PASSOWRD(' grant

‘)); bbs

. 18.2 apache apache

. :

z z Perl

50MB (

5.003

.

)

. .

# rpm -qa | grep perl -v # which perl # perl -v apache

, ,

. .

z

apache

.

- 5 -


(DSO, Dynamic Shared Object)

z autoconf

apache . apache .

. .

rpm -e

apache

.

1. www.apache.org

z

httpd-2.0.48.tar.gz 2. gunzip

z

.

. tar

.

# gunzip httpd-2.0.48.tar.gz # tar xvf httpd-2.0.48.tar 3. httpd-2.0.48/

z

./configure

.

# ./configure --prefix=PREFIX PREFIX

.

--prefix

/usr/local/apache2

.

, . . # INCLUDES=-I/usr/kerberos/include ./configure --prefix=/usr/local/apache --with-mpm=worker --enable-so --enable-mods-shared="auth_dbm auth_digest ssl usertrack" --with-berkeley-db=/usr/local/BerkeleyDB.4.1 z

4.

make .

# make z

5.

make install .

# make install z

6.

apache

/etc/ld.so.conf

,

- 6 -


/usr/local/apache/lib /usr/local/apache/modules ldconfig

.

# vi /etc/ld.so.conf # ldconfig z

7.

.

# vi /usr/local/apache/conf/httpd.conf 18.2.3 z

.

8.

.

# /usr/local/apache/bin/apachectl start # /usr/local/apache/bin/apachectl stop z

9.

.

# cp /usr/local/apache/bin/apachectl /etc/init.d/httpd # vi /etc/init.d/httpd . # chkconfig: 2345 85 15 # description: apache is a world wide web server. . # chkconfig --add httpd 18.2.1 configure z --with-mpm=:

apache .

prefork

.

worker .

perchild, threadpool

.

z “mod_

. .

--enable-MODULE[=shared] MODULE

. “=shared”

DSO

.

) --enable-cgi --disable-MODULE MODULE

.

- 7 -


--enable-modules=MODULE_LIST . --enable-mods-shared=MODULE_LIST DSO . ) --enable--mods-shared="so ssl" z --with-berkeley-db[=path]: apache

.

DB

.

--with-berkeley-db=/usr/local/BerkeleyDB.4.1 18.2.2 apache

.

z mod_access : base IP

, . Allow <Directory>,

Deny <Files>

.

z mod_actions : base CGI

.

z mod_alias : base URL

(Redirect), (Alias)

. ScriptAlias

Alias

cgi

.

z mod_auth : base . . z mod_auth_dbm : extension

- 8 -


. z mod_auth_digest : experimental , MD5 . z mod_cgi : base cgi

.

z mod_imap : base map

.

z mod_mime : base . z mod_so : extension DSO

.

z mod_ssl : extension SSL(Secure Socket Layer)

.

z mod_status : base . z mod_userdir : base . . z mod_usertrack : extension . 18.2.3 httpd.conf

- 9 -


httpd.conf

. .

z ServerType standalone .

standalone

. z ServerType /usr/local/apache . z PidFile /usr/local/apache/logs/httpd.pid . z Timeout 300 .

.

z KeepAlive On KeepAlive . z MaxKeepAliveRequest 100 Keepalive .

.

z KeepAliveTimeout 15 KeepAlive . z <IfModule worker.c> StartServers

2

MaxClients

150

MinSpareThreads

25

MaxSpareThreads

75

ThreadsPerChild

25

MaxRequestsPerChild

0

</IfModule> worker

.

z Listen 80

- 10 -


z User nobody z Group #-1 . #-1 /etc/group

. .

# groupadd -g 80 httpd z ServerAdmin sangjin@kut.ac.kr . z ServerName infosec.kut.ac.kr:80 . DNS IP

.

z DocumentRoot "/usr/local/apache/htdocs" . z <Directory /> Options FollowSymLink AllowOverride None </Directory> . , .

Indexes, Includes, FollowSymLinks, ExecCGI,

SymLinksifOwnerMatch, MultiViews

, Allow

Deny

. Indexes: .

.

FollowSymLinks:

.

AllowOverride: .htaccess

. None

.htaccess

, Authconfig , Limit

.htaccess

. Order

.

Allow

.

- 11 -


Deny

.

1) Order Allow,Deny Allow from all . 2) Order Deny,Allow Deny from all Allow from 220.68.70 220.68.70

.

z UserDir public_html . ~user

.

z AccessFileName .htaccess . z LanguagePriority .

ko

. z AddDefaultCharset

EUC-KR .

EUC-KR

.

z AddType mime

.

z AddHandler . 18.3 PHP PHP PHP

www.php.net

. PHP

,

apache

DSO mod_so

. z

1. www.php.net php-4.3.4.tar.gz

z

2. gunzip

. .

tar

.

# gunzip php-4.3.4.tar.gz

- 12 -

.


# tar xvf php-4.3.4.tar 3. php-4.3.4/

z

./configure

.

# ./configure --with-mysql --with-apxs2=/usr/local/apache/bin/apxs --with-openssl --with-config-file-path=/etc 4.

z

make .

# make 5.

z

make install .

# make install 6. php.ini

z

/etc

.

# cp php.ini-dist /etc/php.ini 7 httpd.conf

z

.

LoadModule php4_module modules/libphp4.so AddType application/x-httpd-php .php .htm .html .inc .php4 .php3 8.

z

info.php DocumentRoot

.

<? phpinfo(); ?> php 18.4 apache 18.4.1 mod_status httpd.conf http://

/server-status

. <Location /server-status> SetHandler server-status Order Deny,Allow Deny from all Allow from ... </Location>

- 13 -

.


Allow from . . http://

/server-status?refresh=N N

,

.

18.4.2 .htaccess .htaccess AllowOverride

,

AuthConfig

.

.htaccess . z

1. htdocs

private

z

2. httpd.conf

. .

<Directory /usr/local/apache/htdocs/private> Options FollowSymLinks AllowOverride AuthConfig Order Allow,Deny Allow from all </Directory> z

3.

. .

# mkdir /usr/local/apache/passwd # /usr/local/apache/bin/htpasswd -c /usr/local/apache/passwd/passwd sangjin New password: Re-type password: Adding password for user sangjin z

4.

1

.htaccess

private .

AuthType Basic AuthName "Restricted Files"

- 14 -


AuthUserFile /usr/local/apache/passwd/passwd Require user sangjin AuthType

, Basic . AuthName . AuthUserFile

. Require 5.

z

.

1

private

.

.

linuxcourse .

linuxcourse: sangjin jae jwpark . . /usr/local/apache/passwd/group .htaccess . AuthType Basic AuthName "Restricted to those attending Linux Course" AuthUserFile /usr/local/apache/passwd/passwd AuthGroupFile /usr/local/apache/passwd/group Require group linuxcourse Require valid-user .

.

.

.

- 15 -


1.

z

htpasswd

htdbm

.

.

# /usr/local/apache/bin/htdbm -TDB -c /usr/local/apache/passwd/passwd.db sangjin Enter password

:

Re-type password

:

Database /usr/local/apache/passwd/passwd.db created. -T

, DB

DB

.

2. .htaccess

z

.

AuthType Basic AuthName "Restricted Files" AuthDBMType DB AuthDBMUserFile "/usr/local/apache/passwd/passwd.db" Require user sangjin 18.4.3 zeroboard Zeroboard

PHP

.

MySQL

www.zeroboard.com

.

. z

1. www.zeroboard.com

z

2.

zb41pl4.tar.Z

.

htdocs

.

# tar xvfz zb41pl4.tar.Z # cd .. # chmod -R 707 bbs 3.

z

http://

MySQL DB

/bbs

, BBS

. MySQL DB

18.1 .

http://

/bbs/admin.php

.

- 16 -

.


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.