파일속성설정으로 리눅스파일
보안구현(chattr, lsattr) 5편
특정 디렉토리내의 모든 파일과 디렉토리에 대하여
한번에 속성부여하고 확인하기
이번에는
특정 디렉토리내의 모든 파일들과 디렉토리들을 대상으로 한꺼번에 특정 속성을 설정해 보도록 하겠다.
다음과
같이 bible이라는 디렉토리가 있다.
[root@host3 home]# ls
-l
합계 36
drwxr-xr-x 38 bible
bible 4096 9월 18 18:08
bible
[root@host3 home]#
|
이
디렉토리에는 다음과 같이 수많은 파일들과 디렉토리들이 존재한다.
아래
결과가 너무 많은 까닭으로 일부 결과를 생략하였다.
[root@host3 home]# ls
-lR bible | more
bible:
합계 3732
-rw-r--r-- 1 root
root 8042 8월 27 2001 00-INDEX
drwxr-xr-x 4 root
root 4096 8월 28 03:13
802
drwxr-xr-x 2 root
root 4096 8월 28 03:13
8021q
-rw-r--r-- 1 root root
3699 11월 28 1999 BUG-HUNTING
-rw-r--r-- 1 root
root 12034 9월 5 2002 Changes
-rw-r--r-- 1 root
root 10908 9월 10 2001 CodingStyle
-rw-r--r-- 1 root
root 3483 9월 5 2002 Config.in
-rw-r--r-- 1 root
root 1119065 9월
5 2002 Configure.help
-rw-r--r-- 1 root
root 2434 9월 18 18:04
DIR_COLORS
-rw-r--r-- 1 root
root 2434 9월 18 18:04
DIR_COLORS.xterm
-rw-r--r-- 1 root
root 29594 9월 5 2002 DMA-mapping.txt
drwxr-xr-x 2 root
root 4096 8월 28 03:13
DocBook
-rw-r--r-- 1 root
root 7990 1월 5 2001 IO-mapping.txt
-rw-r--r-- 1 root
root 1362 9월 5 2002 IRQ-affinity.txt
-rw-r--r-- 1 root
root 4528 2월 18 2000 LVM-HOWTO
-rw-r--r-- 1 root
root 1694 9월 5 2002 Makefile
-rw-r--r-- 1 root
root 92336 9월 18 18:04
Muttrc
-rw-r--r-- 1 root
root 932 12월 22 2001 README
-rw-r--r-- 1 root
root 34741 10월 18 2001 README.DAC960
-rw-r--r-- 1 root
root 773 1월 21 2000 README.moxa
-rw-r--r-- 1 root
root 3848 10월 12 2001 README.nsp_cs.eng
이하 결과생략....
|
자, 그럼 bible내에 존재하는 모든 파일과 디렉토리에 i속성을 설정해 보도록 하겠다.
[root@host3 home]# chattr
-R +i bible
[root@host3 home]#
|
아래와
같이 lsattr로 bible디렉토리의 모든 파일과 디렉토리들에게
i속성이 설정된 것을 확인한 것이다.
결과내용이
너무 많은 관계로 일부결과를 생략 하였다.
[root@host3 home]# lsattr
-R bible | more
---i---------- bible/DIR_COLORS
---i---------- bible/DIR_COLORS.xterm
---i---------- bible/Muttrc
---i---------- bible/a2ps-site.cfg
---i---------- bible/a2ps.cfg
---i---------- bible/adjtime
---i---------- bible/aep.conf
---i---------- bible/aeplog.conf
---i---------- bible/aliases
---i---------- bible/aliases.db
---i---------- bible/anacrontab
---i---------- bible/at.deny
---i---------- bible/auto.master
---i---------- bible/auto.misc
---i---------- bible/bashrc
---i---------- bible/cdrecord.conf
---i---------- bible/crontab
이하결과 생략..
|
보셨던
바와 같이 특정 디렉토리내에 있는 모든 파일과 서브디렉토리들을 대상으로 한꺼번에 속성을 부여하고 해제할 수 있다는 것을 알 수 있다.