Python 스크립트를 실행할 수 없습니다. 권한이 거부되었습니다.

Python 스크립트를 실행할 수 없습니다. 권한이 거부되었습니다.

NZBGet(Python) 스크립트를 실행하려고 할 때 다음을 사용하여 수동으로 실행해 보았습니다.

/mnt/local/ext001/MEDIA/NZBGet/scripts/videosort/VideoSort.py

그러나 결과는 다음과 같습니다.

bash: /mnt/local/ext001/MEDIA/NZBGet/scripts/videosort/VideoSort.py: Permission denied

현재 권한으로 이 sudo명령을 실행해 보았 SU으나 777여전히 동일한 메시지가 나타납니다. 허가를 거부하려면 어떻게 해야 합니까?

편집: 다음 명령을 사용해도 파티션이 noexec를 사용하여 마운트되는 것으로 보입니다.

/mnt/local/ext001 ext4 auto,rw,exec,async,user,suid,noatime,nodiratime,relatime 0 2

왜 exec 옵션을 허용하지 않는지 아시나요?

답변1

맞습니다. 여기서는 설치 옵션의 순서가 중요합니다. 매뉴얼 페이지에서:

   users  Allow every user to mount  and  unmount  the  filesystem.   This
          option  implies  the  options  noexec, nosuid, and nodev (unless
          overridden  by  subsequent  options,  as  in  the  option   line
          users,exec,dev,suid).

exec옵션은 이 users옵션 뒤가 아닌 앞에 오므로 이 users옵션이 이를 무시하고 볼륨을 로 설정합니다 noexec.

답변2

Python이 실행 가능하고 파티션을 다시 마운트하고 싶지 않거나 할 수 없는 경우 다음을 실행할 수 있습니다.

python /mnt/local/ext001/MEDIA/NZBGet/scripts/videosort/VideoSort.py

실행 권한 없이 elf(Linux 바이너리 실행 파일) 파일을 실행하려면 다음을 수행할 수 있습니다.

/lib/ld-linux.so.* /path/to/elf/file

답변3

파일을 실행 가능하게 만들어야 합니다.

chmod +x /mnt/local/ext001/MEDIA/NZBGet/scripts/videosort/VideoSort.py  

또는

chmod 555 /mnt/local/ext001/MEDIA/NZBGet/scripts/videosort/VideoSort.py  

그런 다음 다음을 실행할 수 있습니다.

./mnt/local/ext001/MEDIA/NZBGet/scripts/videosort/VideoSort.py.

답변4

예를 들어 일부 컴파일러에서는 vsCode이 문제를 해결하려면 "python3" 대신 "python"을 입력해야 합니다.

예를 들어-:

python manage.py startapp chat

관련 정보