Operating System - HP-UX
1819910 Members
2550 Online
109607 Solutions
New Discussion юеВ

Re: how to enable the crontab for user in hpux

 
SOLVED
Go to solution
senthil_kumar_2
Regular Advisor

how to enable the crontab for user in hpux

Hi All,

I have one user called "john" I would like enable the cron for that user, So i have done following steps in HP-UX 11.31.

1)Added the user name "john" in cron.allow by root

#vi /var/adm/cron/cron.allow
root
adm
uucp
john ---> newly added.

2)Then I have logged in as john.

3)I ran below command and got following error.

# crontab -e
emacs: No such file or directory
crontab: can't create your crontab file in the crontab directory.


How to solve this?
15 REPLIES 15
Tim Nelson
Honored Contributor

Re: how to enable the crontab for user in hpux

check perms on /var/spool/cron/crontabs

Steven E. Protter
Exalted Contributor

Re: how to enable the crontab for user in hpux

Shalom,

Permissions on /var/adm/cron/cron.allow

-r--r--r-- 1 bin bin 137 Mar 10 2009 cron.allow

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
senthil_kumar_2
Regular Advisor

Re: how to enable the crontab for user in hpux

Hi Tim Nelson,

Please find the details.

# cd /var/spool/cron/
# ll
drwxrwxrwx 2 bin bin 96 Apr 13 08:34 crontabs
senthil_kumar_2
Regular Advisor

Re: how to enable the crontab for user in hpux

Hi Steven,

# ll /var/adm/cron/cron.allow
-rw-r--r-- 1 bin bin 23 Apr 13 06:40 /var/adm/cron/cron.allow
R.O.
Esteemed Contributor

Re: how to enable the crontab for user in hpux

Hi,

Try to change your $EDITOR variable from "emacs" to "vi" and try again.

Regards,
"When you look into an abyss, the abyss also looks into you"
Pete Randall
Outstanding Contributor

Re: how to enable the crontab for user in hpux

I too would suspect the editor. Emacs has a habit of trying to create a backup file suffixed with a ~, and you don't have permissions.


Pete

Pete
Pete Randall
Outstanding Contributor

Re: how to enable the crontab for user in hpux

Oops! I just now saw the directory permissions so that would tend to blow that theory. I'd still be interested to see the results of changing your editor variable.

export EDITOR=vi

then retry "crontab -e"


Pete

Pete
senthil_kumar_2
Regular Advisor

Re: how to enable the crontab for user in hpux

Not able to change the editor.

I tried following methods.

1)# vi /home/john/.profile

export EDITOR = vi


1.1)then I loged in as john

1.2)# crontab -e
emacs: No such file or directory
crontab: can't create your crontab file in the crontab directory.

1.3)# echo $EDITOR
emacs


Then I have tried following steps.

2)# vi /etc/profile

export EDITOR = vi

2.1)then I loged in as john

2.2)# crontab -e
emacs: No such file or directory
crontab: can't create your crontab file in the crontab directory.

2.3)# echo $EDITOR
emacs


How to solve the issue



R.O.
Esteemed Contributor
Solution

Re: how to enable the crontab for user in hpux

export EDITOR=vi (without spaces within)

Regards,
"When you look into an abyss, the abyss also looks into you"
Robert-Jan Goossens_1
Honored Contributor

Re: how to enable the crontab for user in hpux

change the following the user .profile

export EDITOR = vi

to

export EDITOR=vi

no spaces

Robert-Jan
Pete Randall
Outstanding Contributor

Re: how to enable the crontab for user in hpux

Better yet, don't bother editing ANY profiles. Just log in as John and type

export EDITOR=vi
crontab -e

and see what happens.


Pete

Pete
Pete Randall
Outstanding Contributor

Re: how to enable the crontab for user in hpux

And post the following, please:

ll /usr/lib/cron/cron.allow

- and/or -

ll /var/adm/cron/cron.allow


Pete

Pete
Steven E. Protter
Exalted Contributor

Re: how to enable the crontab for user in hpux

Shalom,

Is the system trusted?

I remember, long ago running into a problem adding oracle to cron allow user list on a trusted system.

Had to run through a special procedure to fix it.

Though I recall betting a pretty specific error message which we are not seeing here.

As user John:

env > /tmp/john.env.txt

Take a look there.

It is possible but not advisable as root to directly edit the cron schedules in /var/spool/cron/crontabs

See what if anything is there.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
senthil_kumar_2
Regular Advisor

Re: how to enable the crontab for user in hpux

Now it is working fine after changing as follows

export EDITOR = vi

to

export EDITOR=vi

no spaces
Bill Hassell
Honored Contributor

Re: how to enable the crontab for user in hpux

The EDITOR variable is probably being overridden in the user's profile (~john/.profile or worse, ~john/.cshrc). Type this one-line command exactly as shown (no extra semicolons or other junk):

sh EDITOR=vi crontab -e

and it will work OK even if the user is running the scummy csh shell.

NOTE: drwxrwxrwx is a severe security risk for your system. Someone tried to fix a problem by compromising the security of every cron job with 777 permissions. The correct permission is 555 owned by bin:bin.


Bill Hassell, sysadmin