Bad user root in crontab

Hi everyone,

I got error which is "!bad user (root)" in crontab...

I tried changing password,
I checked etc/cron/cron.allow and cron.deny,
And also I checked the permissions of my files,

its(my crontab script) still not working....

Please help...

check the /etc/shadow file if your acc is locked .

thanks for your help,

I checked shadow file and user (root) is not locked...

what else can be?

most likely this is due to expiry or locking of account. Check the bellow link and give a try .

CRON: bad user - Sun Solaris

1 Like

still not working....
there is no warn for pass in shadow file.

Thanks anyway... but i ll be waiting for other advises...
I have been trying to solve this problem from like 5 days...
I guess there is a solaris/cron expert in somewhere here... :slight_smile:

Please post what exact Operating System and version you are running. Please make it clear whether crontabs other than root are affected too.
Please post:

ls -la /var/spool/cron/crontabs

Please post:
Three consecutive error entries from the cron log complete with timestamps.
Can you match these to actual crontab lines?

Please run:

# Password file checker program
pwck
# Group file checker program
grpck

Please check:
That root is the very first line in /etc/passwd and /etc/shadow .
(I've seen some very strange results when someone sorted the passwd file).

Please post the contents of:

/etc/default/cron

Operation system solaris(sunOS 5.10 Generic) And in cron log there is error (bad user root) only for root.

  1. with ls -la /var/spool/cron/crontabs
root  sys         adm
root  root          lp
root  root          root
root   root       root.au
root   sys            sys
root   sys           uucp    

comes.

2.there is no return for pwck and grpck commands

(I think it means passwords are ok or there is no inconsistencies.)

  1. YES the root is the first line in passwd and shadow files
    and
    they are like below
passwd        root:x:::Super-user:/:/user/bin/bash
shadow        root:$md5$11111122223333444/:15443::::::

And "cronlog=YES" in /etc/default/cron

Thanks for help...

root.au - what is that crontab file for? More specifically -
when you do ANYTHING with crontabs you use the crontab -e command

So, following that concept as root you execute

crontab -e root.au

to create a crontab: root.au Did you use some other method to make that crontab?
Is there a root.au user in group sys? I think this is the cause of your problem, not the root account.

1) The root Shell entry in /etc/passwd looks wrong to me. Is it really /user/bin/bash ?
When was the root Shell changed to bash ?
The root passwd entry has no UID and GID fields.
Anybody know what is going on here?
If you grep "root" /etc/passwd do you only find one line?

2) Please post the full directory listing because the timestamps, file permissions and file sizes could be important.

ls -la /var/spool/cron/crontabs

3) Please post:
Three most recent consecutive comand and error entries from the cron log complete with timestamps.
Can you match these to actual crontab lines?
I'm asking this because cron can also run "at" jobs and to determine whether cron is still running and to check where it is finding the failing jobs.

hi, @jim mcnamara
there is a crontab file for root.au but its empty and
there is no group for root.au user sys.
Actually there is no cron job for root.au.
I connect to machine with root user. I create crontab with root user...
I mean, I did almost everything with root user.

---------- Post updated at 04:56 AM ---------- Previous update was at 04:27 AM ----------

hi @methyl,

I am really sorry. I typied accidently wrong. its /usr/bin/bash in passwd file.
1.Yes there is no UID or GID for root but it has group in /etc/group file.
(could that be reason for this error?)

And when I grep "root" /etc/passwd single line comes.

2.when I ls -la to crontab file the full line is

-rw---------- 1 root root 844 May 3 14:38 root

3.No... n the log file errors are the same...

t is

! bad user (root) thu may 3 14:50 2012
! bad user (root) thu may 3 14:51 2012
! bad user (root) thu may 3 14:52 2012 (this script must work every minute. Which gives error)

keep going like this...

Please post the complete output from:

crontab -l root

And the complete output from:

ls -la /var/spool/cron/crontabs

Can you tell from the cron log whether cron is actually attempting to run any jobs or is this cron's normal one-minute polling interval failing.
Please post a few lines from the top of /etc/passwd so we can compare whether the root line is odd or start looking for some other authentication method.
Has anybody been editing the root line in /etc/passwd ?

Anybody viewing who has sunOS 5.10 Generic got a view on the root lines posted above from /etc/passwd and /etc/shadow ?
Is there a valid scenario whereby the UID and GID fields can be blank? Is it valid to have bash as the root Shell ?

crontab -l root

00 12  * * * /data/usr/shfolder/datapump.sh
ls -la /var/spool/cron/crontabs

-rw----------  1    root     sys       190   Apr 24 09:16  adm
-r-----------   1    root     root     450    apr   24   09:16   lp
-rw----------   1    root     root      844   May 3   16:45    root
-r------------   1    root     root       49    May 3    16:45    root.au
-rw----------  1     root     sys       308   Apr 24    09:16     sys
cat /etc/passwd

root:x:0:0:Super-User:/:/usr/bin/bash
bin:x:1:1::/:
sys:x:2:2::/:

Cron does not run any jobs, And yes... it gives bad user error every one-minute

---------- Post updated 05-10-12 at 04:52 AM ---------- Previous update was 05-09-12 at 11:37 PM ----------

Solved....

it's just because ,   hostname of machine....

all hostname's in /etc/hosts/ must be the same and correct...

Thank you for posting the solution. Can you be more specific about what was wrong with /etc/hosts , or was it a cron job which relied on /etc/hosts ? Not clear to me whether cron itself went faulty or whether one cron job went faulty.

Btw. Post #11 was quite misleading because of the three typing errors in the root line in /etc/passwd.