본문 바로가기
인프라/Linux

[Linux] 권한

by bloodFinger 2020. 6. 30.

파일 ,디렉토리 (read & write & excute)

-rw-rw-r-- 1 egoing egoing 0 Dec 4:23:19 perm.txt
//  -rw-rw-r-- : access mode 
// -rw : owner의 권한 , -rw : group의 권한 , -r : other 권한
// r : read , w : write , x:excute

//  egoing egoing :  owner / group

  

 

권한 변경

//other 권한 변경
chmode o-r perm.txt
chmode o+r perm.txt
chmode o+w perm.txt



//소유자 권한
chmode u-r perm.txt
chmode u+r perm.txt

 

+권한 변경은 h2 db 실행할때 excute 권한을 부여했을때 사용해봤던 기억이 난다!

ex)

cd Downloads/h2/bin
chmod +x h2.sh
./h2.sh

 

 


 

directory

 

mkdir perm; cd perm; echo 'hi' > perm.txt

 

 

 

 


연산자와 클래스의 조합으로 권한주기

 

 

방식 1.

chmod  o+r


chmod 111 perm.txt

chmod 110 perm.txt

chmod 222 perm.txt

chmod 444 perm.txt

// 1 : execute only , 2:write only ,  1+2 = write and execute
chmod 333 perm.txt

 

방식2.

//모든곳에 read 넣기
chmod a+r perm.txt

chnmod a+w perm.txt

 

방식3.

chmod a=rwx perm.txt

chmod a= perm.txt

chmod a=r perm.txt

 

 

 


GROUP ?

 

access mode의 그룹은 무엇인가? 살펴보자 

 

 

'인프라 > Linux' 카테고리의 다른 글

[Linux]다중 사용자  (0) 2020.06.29
[Linux]프로세스와 실행  (0) 2020.06.22
[Linux] 디렉토리 구조 / 파일 찾는법(find , whereis )  (0) 2020.06.17
기본적인 Shell script  (0) 2020.06.16
리눅스 기본적인 명령어 정리  (0) 2020.06.09