我正在尝试从 MariaDB 服务器运行 python 脚本。我为此安装了 mysqludf 库。我正在尝试使用 sys_exec 函数运行脚本,但没有结果。我创建了一个测试文件,它只是一个带有“DONE”信息的 .txt 文件。
我以 root 用户身份执行命令,因此我拥有所有权限。运行命令:
SELECT sys_exec('python3 /home/Documents/test.py')
不执行任何操作并返回错误代码 512。运行命令:
SELECT sys_exec('sudo python3 /home/Documents/test.py')
返回错误代码 256。
我已经检查了 apparmor 状态,似乎没有什么问题:
apparmor module is loaded.
42 profiles are loaded.
40 profiles are in enforce mode.
/sbin/dhclient
/snap/core/4486/usr/lib/snapd/snap-confine
/snap/core/4486/usr/lib/snapd/snap-confine//mount-namespace-capture-helper
/snap/core/6964/usr/lib/snapd/snap-confine
/snap/core/6964/usr/lib/snapd/snap-confine//mount-namespace-capture-helper
/snap/core/7169/usr/lib/snapd/snap-confine
/snap/core/7169/usr/lib/snapd/snap-confine//mount-namespace-capture-helper
/snap/core/7270/usr/lib/snapd/snap-confine
/snap/core/7270/usr/lib/snapd/snap-confine//mount-namespace-capture-helper
/usr/bin/evince
/usr/bin/evince-previewer
/usr/bin/evince-previewer//sanitized_helper
/usr/bin/evince-thumbnailer
/usr/bin/evince//sanitized_helper
/usr/bin/man
/usr/lib/NetworkManager/nm-dhcp-client.action
/usr/lib/NetworkManager/nm-dhcp-helper
/usr/lib/connman/scripts/dhclient-script
/usr/lib/cups/backend/cups-pdf
/usr/lib/snapd/snap-confine
/usr/lib/snapd/snap-confine//mount-namespace-capture-helper
/usr/sbin/cups-browsed
/usr/sbin/cupsd
/usr/sbin/cupsd//third_party
/usr/sbin/ippusbxd
/usr/sbin/tcpdump
man_filter
man_groff
snap-update-ns.core
snap-update-ns.eclipse
snap-update-ns.gnome-calculator
snap-update-ns.gnome-characters
snap-update-ns.gnome-logs
snap-update-ns.gnome-system-monitor
snap-update-ns.pycharm-community
snap.core.hook.configure
snap.gnome-calculator.gnome-calculator
snap.gnome-characters.gnome-characters
snap.gnome-logs.gnome-logs
snap.gnome-system-monitor.gnome-system-monitor
2 profiles are in complain mode.
snap.eclipse.eclipse
snap.pycharm-community.pycharm-community
4 processes have profiles defined.
4 processes are in enforce mode.
/sbin/dhclient (734)
/usr/sbin/cups-browsed (33904)
/usr/sbin/cupsd (33899)
/usr/sbin/cupsd (33928)
0 processes are in complain mode.
0 processes are unconfined but have a profile defined.
我还仔细检查了 root 是否具有 sudo 权限,如果确实如此。
什么可能导致问题?有什么方法可以从 MariaDB 服务器运行 python 脚本吗?