๋ฆฌ๋ ์ค ํ์ผ ๊ถํ
๋ฆฌ๋ ์ค ํ์ผ์ user, group, others ๋ณ๋ก read, write, execute ๊ถํ์ ๋ถ์ฌํ ์ ์์ต๋๋ค.
ls ๋ช ๋ น์ผ๋ก ํ์ฌ ํ์ผ์ ๋ถ์ฌ๋์ด ์๋ ๊ถํ์ ํ์ธํ ์ ์์ต๋๋ค.
[root@peterdev ch]# ls -l
total 0
-rw-r--r-- 1 root root 0 Jun 4 08:45 test.txt
-rw-r--r-- ์์ ๋งจ์์ - ๋ file ์ธ์ง directory์ธ์ง ๊ตฌ๋ถํ๋ symbol ์ ๋๋ค.
[root@peterdev test]# ls -l
total 44
-rwxr-xr-x 1 root root 8576 May 10 08:38 a.out
-rw-r--r-- 1 root root 214 May 10 08:38 arr1.c
-rw-r--r-- 1 root root 425 May 10 07:30 arr.c
drwxr-xr-x 2 root root 4096 Jun 4 08:45 ch
drwxr-xr-x 2 root root 4096 May 3 14:27 john
-rw-r--r-- 1 root root 0 May 8 14:40 mv_test.dat
-rw-r--r-- 1 root root 0 May 9 06:06 new_file
-rw-r--r-- 1 root root 5 May 9 06:09 new.txt
drwxr-xr-x 2 root root 4096 May 3 14:27 peter
-rw-r--r-- 1 root root 33 May 14 09:00 test1.txt
-rw-r--r-- 1 root root 33 May 8 14:56 test2.txt
์ด๋ ๊ฒ directory์ธ ๊ฒฝ์ฐ์๋ d ๋ผ๋ symbol๋ก ํ์๋ฉ๋๋ค.
rw-r--r-- ๋ก ํ์๋๋ ๋ถ๋ถ์ด ๋ถ์ฌ๋ ๊ถํ์ ๋ํ๋ด๋๋ฐ 3๊ฐ์ฉ ๋์ด์ ๋ณด๋ฉด
์์ 3๊ฐ๊ฐ user ์ฆ ์์ ์(owner)์ ๊ถํ์ด๊ณ ,
์ค๊ฐ์ 3๊ฐ๋ group ์ ๋ํ ๊ถํ,
๋ง์ง๋ง 3๊ฐ๊ฐ others ์ ๋ํ ๊ถํ์ด ๋ฉ๋๋ค.
์ด ๊ถํ์ 8์ง์๋ก ํํํ๋ฉด rwx ๊ถํ์ ๋ค ๊ฐ๋ ๊ฒฝ์ฐ 7์ด ๋ฉ๋๋ค.
๊ฐ ๊ถํ์ ์ซ์๊ฐ์ผ๋ก ํํํ๋ฉด r = 4, w = 2, x = 1 ์ด๊ธฐ ๋๋ฌธ์
r + w + x = 7
์ด๋ ๊ฒ ๋๋ ๊ฒ์ด์ฃ .
ํ์ผ์ user์ group ์ ๋ํด์๋ง read ๊ถํ์ ๋ถ์ฌํ๋ ค๋ฉด 440 ์ผ๋ก ์ ์ฉํ๋ฉด ๋ฉ๋๋ค.
+, - ๊ธฐํธ๋ฅผ ์ฌ์ฉํด์ ํน์ ๊ถํ์ ๋ํ๊ฑฐ๋ ๋บ ์๋ ์์ต๋๋ค.
์์
chmod 700 test.txt
chmod +x test.txt
chmod g+w test.txt
chmod o-rwx test.txt
์ถ์ฒ: https://gracefulprograming.tistory.com/111 [Peter์ ์ฐ์ํ ํ๋ก๊ทธ๋๋ฐ]
'OS > Linux' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Linux] ๊ทธ๋ฃน(Group)๊ฐ๋ & ๊ถํ์์ (0) | 2022.05.02 |
---|---|
Windows ํฐ๋ฏธ๋์์ WSL ์์ ๊ฒฝ๋ก ๋ณ๊ฒฝํ๊ธฐ (0) | 2022.05.02 |
crontab์ผ๋ก docker python์์ .pyํ์ผ ์๋ ์คํ (0) | 2022.04.06 |
๋ฆฌ๋ ์ค group ๊ถํ ์ฃผ๊ธฐ (0) | 2022.04.01 |
์ธ์ฅ๋ฉ๋ชจ๋ฆฌ ๋ง์ดํธ ํ๋๋ฒ (0) | 2022.03.14 |