답변:
쉘 스크립트 파일에 대한 사용 권한을 변경하여 루트로 자동 실행되도록 할 수 있습니다.
chmod 맨 페이지에서 :
4000 (the set-user-ID-on-execution bit) Executable files with
this bit set will run with effective uid set to the uid of
the file owner. Directories with the set-user-id bit set
will force all files and sub-directories created in them to
be owned by the directory owner and not by the uid of the
creating process, if the underlying file system supports
this feature: see chmod(2) and the suiddir option to
mount(8).
샘플 명령은 다음과 같습니다.
sudo chown root:root file.sh
sudo chmod 4755 file.sh