Выполнить скрипт Python от имени root в Ubuntu, «id | grep «uid=0» >/dev/null» выдает ошибку ⇐ Python
-
Anonymous
Выполнить скрипт Python от имени root в Ubuntu, «id | grep «uid=0» >/dev/null» выдает ошибку
I am trying to build a test package for a Synology DSM using their toolkit and one of the steps requires to execute a Python script. When I execute it an exception is thrown:
/pkgscripts-ng/include/check: line 93: /dev/null: Permission denied ERROR: This script must be run as root Here is the function responsible for this error:
CheckPermission() { # Only root can run this id | grep "uid=0" >/dev/null if [ $? != "0" ]; then echo "ERROR: This script must be run as root"; echo ""; exit 1; fi # Stop!! If /root/.chroot does not exit if [ ! -f /root/.chroot ]; then echo "ERROR: Please chroot first!!" echo "" exit 1; fi } My dev virtual machine runs on Ubuntu 22.04.3. Installed version of Python: 3.10.12
I am executing the script as a root user (executed sudo -i in the terminal window, then double checked with whoami), so my understanding is that all the required privileges are there. If I execute id | grep "uid=0" >/dev/null in the same terminal window I don't get any error.
Unfortunately I am not a Python developer and googling didn't bring me much.
Источник: https://stackoverflow.com/questions/780 ... ull-throws
I am trying to build a test package for a Synology DSM using their toolkit and one of the steps requires to execute a Python script. When I execute it an exception is thrown:
/pkgscripts-ng/include/check: line 93: /dev/null: Permission denied ERROR: This script must be run as root Here is the function responsible for this error:
CheckPermission() { # Only root can run this id | grep "uid=0" >/dev/null if [ $? != "0" ]; then echo "ERROR: This script must be run as root"; echo ""; exit 1; fi # Stop!! If /root/.chroot does not exit if [ ! -f /root/.chroot ]; then echo "ERROR: Please chroot first!!" echo "" exit 1; fi } My dev virtual machine runs on Ubuntu 22.04.3. Installed version of Python: 3.10.12
I am executing the script as a root user (executed sudo -i in the terminal window, then double checked with whoami), so my understanding is that all the required privileges are there. If I execute id | grep "uid=0" >/dev/null in the same terminal window I don't get any error.
Unfortunately I am not a Python developer and googling didn't bring me much.
Источник: https://stackoverflow.com/questions/780 ... ull-throws