给cronjob拒绝OSerror 13的许可错误的脚本?

时间:2013-06-11 14:31:50

标签: python python-2.7 subprocess crontab

我已经从python中编写了一个脚本来自动扫描。我已经使用了nessus并在python中使用了子进程模块.Probem就是它从cli bash运行....但是当我把那个脚本用于启动时通过cronjob。它出现以下错误

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 job命令

16 14 * * * cd /root/nessus; ./nessusscan.py

尽快发布帮助

1 个答案:

答案 0 :(得分:1)

错误意味着程序是由子进程找到的,但运行“nessusscan.py”的用户无权运行它。

检查nessus文件的所有权及其权限。