Showing posts with label cronjob. Show all posts
Showing posts with label cronjob. Show all posts

Warning - Invalid account: 'sys' not allowed to execute cronjobs

In Solaris 11

error when try to enable / set cronjob for a user.
root@abc:/etc/cron.d# crontab -e sys
Warning - Invalid account: 'sys' not allowed to execute cronjobs

Pls check if the account has been locked, unlock it as below and retry
root@abc:/var/adm/sa# grep sys /etc/shadow
sys:*LK*NP:6445::::::

root@abc:/var/adm/sa# passwd -u sys
WARNING: changing account in reserved uid range: sys.
passwd: password information changed for sys


Linux cron: /tmp/crontab.XXXX file

I noticed some files under /tmp with the name of crontab.XXX as below:

-rw-------  1 anthony  root      949 Jul 11 09:10 crontab.XXXXS2IaZU
-rw-------  1 anthony  root      950 Jul 11 09:10 crontab.XXXXSNwiwK

What are those?

These are the temp file created when you issued the crontab -e command.
Possible single crontab being edited by 2 different session?

Anyhow, these files can be remove, just make sure you got your effective cron being stored under /var/spool/cron folder.

Linux cron entry: ORPHAN (no passwd entry)

I saw an entry in my /var/log/cron file as below:


Jul 10 08:01:01 server1 crond[3420]: (tmp.XXXXEXYFUw) ORPHAN (no passwd entry) 

What could be the possible meaning of this?

This will occur if there's a file in the /var/spool/cron directory that doesn't match up to a username and UID. So if you find /var/spool/cron/anthony --you must be able to 'id anthony'. Or you can just grep from /etc/passwd file.

One of the reason could be as a result of creating a backup file for root /var/spool/cron/anthony.back. Since there is no UID for user "anthony.back" then it's considered ORPHAN.

Make sense? Here's the code --this conditional has probably not changed for years...

if (strcmp(fname, "*system*") && !(pw = getpwnam(uname))) {
/* file doesn't have a user in passwd file.
*/
log_it(fname, getpid(), "ORPHAN", "no passwd entry");
goto next_crontab;
}