Search code examples
permissionscronsudocron-task

Cron job permission denied


I'm running a python script called TGubuntu.py. I used ls -l , and the permissions of the script are -rwxrwxrwx 1 ubuntu ubuntu 503 Jan 13 19:07 TGubuntu.py, which should mean that anyone can execute the file, right?

But I still get in the log /bin/sh: 1: /home/ubuntu/TestTG/TGubuntu.py: Permission denied for some reason. When I run the script manually it works perfectly. Any Ideas?

I put it in the sudo crontab like this

* * * * * /home/ubuntu/TestTG/TGubuntu.py

But even in the root (cron) mail log it says Permission Denied!


Solution

  • Couldn't figure out what the problem was, so I accomplished my goal using a different method. I ran a python script that uses the schedule module to call my script. Then I just let the "Timer" run on screen indefinitely.