Cron job fails - permission denied

TimoJ

Dabbler
Joined
Jul 28, 2018
Messages
39
Any tips what is causing cron job not to run? Using root account for it and the same script runs fine in shell terminal. But when I try to run it via Cron Job's run job button, I get two permission error reports via email:

root : unable to open /etc/sudoers : Permission denied ; PWD=/ ; USER=root ;

sudo: unable to open /etc/sudoers: Permission denied
sudo: no valid sudoers sources found, quitting
sudo: error initializing audit plugin sudoers_audit
 
Joined
Jun 2, 2019
Messages
591
Just a wild guess without details, but are you using "sudo" in front of command?

Can you post a screen cap or text of your cron settings?

In particular
  1. What is the command you use to manually run command/script?
  2. Cron command
  3. Cron user
  4. Single command or script? If script,
    1. Path to script
    2. Owner and permissions of script (ls -la {filename})
    3. Does script have correct shebang first line?
 

TimoJ

Dabbler
Joined
Jul 28, 2018
Messages
39
Just a wild guess without details, but are you using "sudo" in front of command?

Can you post a screen cap or text of your cron settings?

In particular
  1. What is the command you use to manually run command/script?
  2. Cron command
  3. Cron user
  4. Single command or script? If script,
    1. Path to script
    2. Owner and permissions of script (ls -la {filename})
    3. Does script have correct shebang first line?
Attached screen capture.
1. in root directory: ./report_scale.sh
2. /root/report_scale.sh
3. root
4. script
1. /root
2. -rwxr-xr-x 1 root root
3. #!/bin/bash


cron.png
 
Joined
Jun 2, 2019
Messages
591
1. Move script to a data pool, otherwise it will be lost during upgrade/re-install
2. Change cron command to
Code:
/bin/bash /{path}/{file}
 

TimoJ

Dabbler
Joined
Jul 28, 2018
Messages
39
1. Move script to a data pool, otherwise it will be lost during upgrade/re-install
2. Change cron command to
Code:
/bin/bash /{path}/{file}
Still the same problem.
 
Joined
Jun 2, 2019
Messages
591
Your signature says CORE, but the script filename implies SCALE

If SCALE, change the cron command to

Code:
/usr/bin/bash /{path}/{file}



Or you have something in your script that is causing the error.

This should point you in the right direction.

Code:
sudo: error initializing audit plugin sudoers_audit
 
Last edited:

TimoJ

Dabbler
Joined
Jul 28, 2018
Messages
39
Your signature says CORE, but the script filename implies SCALE

If SCALE, change the cron command to

Code:
/usr/bin/bash /{path}/{file}



Or you have something in your script that is causing the error.

This should point you in the right direction.

Code:
sudo: error initializing audit plugin sudoers_audit
This is SCALE message area so I thought I didn't have to mention it, installed is just yesterday (and rollback to Core isn't working). I changed cron command to /usr/bin/bash and still the same problem. Also changed the script to contain only ls -la and still the same problem. I guess it's time to reinstall CORE...
 

paxswill

Cadet
Joined
Jul 16, 2019
Messages
5
There's another thread with the same root issue where I posed the fix:
 
Top