*Programming/[ SS ] Shell Script
[SS - 10] 파일 실행 시 root 권한 확인
사2다
2021. 12. 30. 17:16
728x90
반응형
shell script
#! /bin/bash
# check root
if [ "$EUID" -ne 0 ]; then
echo "root 권한 실행 필요"
exit
fi
실습
- test 계정으로 파일 실행
- EUID 확인 후 아닐 경우 exit 수행
728x90