Ultimately the goal is to set up a monthly cron to run a web server security certificate renewal command. But this is my first dive into cron so I created a simple test example which pops up a message box every minute. It works as expected when I specify my user name but refuses to work under root. I want this command to run no matter who is logged in so I expect root is the proper user account. Here is the working test cron command:
I expected that substituting root for geno would accomplish the same tasks but no such luck. Errors while using root include the following:
Mar 24 20:01:01 safeandtacticalfirearmstraining.com cron[1232]: (root) BAD FILE MODE (/etc/crontab)
Mar 24 20:16:01 safeandtacticalfirearmstraining.com cron[1232]: (root) BAD FILE MODE (/etc/crontab)
Mar 24 20:17:01 safeandtacticalfirearmstraining.com cron[1232]: (root) BAD FILE MODE (/etc/crontab)
Mar 24 20:24:01 safeandtacticalfirearmstraining.com cron[1232]: (root) BAD FILE MODE (/etc/crontab)
Mar 24 20:25:01 safeandtacticalfirearmstraining.com cron[1232]: (root) BAD FILE MODE (/etc/crontab)
Mar 24 20:26:01 safeandtacticalfirearmstraining.com cron[1232]: (root) BAD FILE MODE (/etc/crontab)
Mar 24 20:31:01 safeandtacticalfirearmstraining.com cron[1232]: (root) BAD FILE MODE (/etc/crontab)
Online research reveals that cron is particular about file permissions, so I made sure the file was owned by root with rwx permissions. I also assigned a group that included the cron user as well as my user geno.
A related issue: When I use sudo crontab -e a blank text file pops up. The crontab file I expect to load is at /etc/ which is populated with instructions and comments. I’ve found a crontab file at /usr/bin with the proper date but that does not correspond with any online documentation i’ve read so far. How do I get crontab -e to load the crontab file at /etc/?
hcvv, I understand your explanation and examples. As I was experimenting I was using a terminal logged in as root. It stands to reason then, that the command credentialed with root should have worked and the one credentialed as geno should have failed - but it worked in reverse. Examples below:
Which problem? You did not show any evidence that your cron job has not run. If your problem is “how to allow other users to access my $DISPLAY” - read man Xsecurity and man xhost or make an Internet search for this phrase. And if you still has questions, start new topic with suitable subject. It is completely unrelated to cron.