yumyum

[Linux]권한설정 본문

ICT기반 클라우드 네트워크 해킹 침해대응전문가/Linux

[Linux]권한설정

yumyum0603 2023. 8. 30. 16:10

[chage 명령어]

[root@localhost home]# chage
Usage: chage [options] LOGIN

Options:
  -d, --lastday LAST_DAY        set date of last password change to LAST_DAY
  -E, --expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE
  -h, --help                    display this help message and exit
  -I, --inactive INACTIVE       set password inactive after expiration
                                to INACTIVE
  -l, --list                    show account aging information
  -m, --mindays MIN_DAYS        set minimum number of days before password
                                change to MIN_DAYS
  -M, --maxdays MAX_DAYS        set maximum number of days before password
                                change to MAX_DAYS
  -R, --root CHROOT_DIR         directory to chroot into
  -W, --warndays WARN_DAYS      set expiration warning days to WARN_DAYS

 

chown : 소유주 바꾸기

chgrp : 그룹 바꾸기

소유주 그룹 한번에 바꾸는 방법

 

 

권한 설정하기

root 권한 허용

ls -al로 사용자, 권한확인하기 

 

(ex)

download 는 그룹, 사용자, 그 외 모두에게 rw 권한주기

upload는 그룹, 사용자(root)에게만 rw 권한주기

 

r : 4

w : 2

x : 1

- : 0

 

이라 rw 권한을 주려면 6의 값을 줘야한다 

 

그러므로 

모두에게 rw 권한을 줘야하는 download는 666의 값을 줘야하고

사용자, 그룹에게만 rw 권한을 줘야하는 upload는 660 값을 줘야한다

 

(ex) rwx 권한을 줘야하면 7의값, r 권한을 줘야하면 4의 값을 줘야한다.

 

[파일 유형]

디렉터리일 경우에는 앞이 d.

일반 파일일 경우에는 앞이 -이다.