我已经从 Python 编写了一个脚本来自动扫描。我为此使用了 nessus 并在 python 中使用了 subprocess 模块。问题是它是从 cli bash 运行的,但是当我将该脚本通过 cron 作业启动时。它给出以下错误
Traceback (most recent call last):
File "/root/nessusscan.py", line 9, in <module>
subprocess.call(['nessus','-q','-x','-T','nessus','127.0.0.1','1241','user','password','ip.txt','res'])
File "/usr/lib/python2.7/subprocess.py", line 493, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 13] Permission denied
脚本是
subprocess.call(['nessus','-q','-x','-T','nessus','127.0.0.1','1241','user','password','ip.txt','res'])
cron 作业的命令
16 14 * * * cd /root/nessus; ./nessusscan.py