ディレクトリのパーミッション

estis2017/04/15 (土) 17:36 に投稿
$ for i in $(seq 0 7)
> do
> mkdir ${i}00
> done

$ ls -l
total 0
drwxr-xr-x  2 user  LOCAL\Domain Users  68  4 15 16:46 000
drwxr-xr-x  2 user  LOCAL\Domain Users  68  4 15 16:46 100
drwxr-xr-x  2 user  LOCAL\Domain Users  68  4 15 16:46 200
drwxr-xr-x  2 user  LOCAL\Domain Users  68  4 15 16:46 300
drwxr-xr-x  2 user  LOCAL\Domain Users  68  4 15 16:46 400
drwxr-xr-x  2 user  LOCAL\Domain Users  68  4 15 16:46 500
drwxr-xr-x  2 user  LOCAL\Domain Users  68  4 15 16:46 600
drwxr-xr-x  2 user  LOCAL\Domain Users  68  4 15 16:46 700

$ for i in $(ls)
> do
> touch $i/FILE0
> done


$ for i in $(ls)
> do
> echo 'TEST' > $i/FILE01
> done

$ ls *
000:
FILE0	FILE01

100:
FILE0	FILE01

200:
FILE0	FILE01

300:
FILE0	FILE01

400:
FILE0	FILE01

500:
FILE0	FILE01

600:
FILE0	FILE01

700:
FILE0	FILE01

$ for i in $(ls)
> do
> chmod $i $i
> done

$ ls -l 
total 0
d---------  3 user  LOCAL\Domain Users  102  4 15 16:48 000
d--x------  3 user  LOCAL\Domain Users  102  4 15 16:48 100
d-w-------  3 user  LOCAL\Domain Users  102  4 15 16:48 200
d-wx------  3 user  LOCAL\Domain Users  102  4 15 16:48 300
dr--------  3 user  LOCAL\Domain Users  102  4 15 16:48 400
dr-x------  3 user  LOCAL\Domain Users  102  4 15 16:48 500
drw-------  3 user  LOCAL\Domain Users  102  4 15 16:48 600
drwx------  3 user  LOCAL\Domain Users  102  4 15 16:48 700

$ ls *
000:
ls: 000: Permission denied

100:
ls: 100: Permission denied

200:
ls: 200: Permission denied

300:
ls: 300: Permission denied

400:
FILE0	FILE01

500:
FILE0	FILE01

600:
FILE0	FILE01

700:
FILE0	FILE01

$ for i in $(ls)
> do
> echo 'Check' > $i/FILE0
> done
-bash: 000/FILE0: Permission denied
-bash: 200/FILE0: Permission denied
-bash: 400/FILE0: Permission denied
-bash: 600/FILE0: Permission denied

$ for i in $(ls)
> do
> cat $i/FILE01
> done
cat: 000/FILE01: Permission denied
TEST
cat: 200/FILE01: Permission denied
TEST
cat: 400/FILE01: Permission denied
TEST
cat: 600/FILE01: Permission denied
TEST

$ for i in $(ls)
> do
> echo 'ADD' > $i/FILE2
> done
-bash: 000/FILE2: Permission denied
-bash: 100/FILE2: Permission denied
-bash: 200/FILE2: Permission denied
-bash: 400/FILE2: Permission denied
-bash: 500/FILE2: Permission denied
-bash: 600/FILE2: Permission denied

$ for i in $(ls)
> do
> rm $i/FILE01
> done
rm: 000/FILE01: Permission denied
rm: 100/FILE01: Permission denied
rm: 200/FILE01: Permission denied
rm: 400/FILE01: Permission denied
rm: 500/FILE01: Permission denied
rm: 600/FILE01: Permission denied