Is CRON only for root user


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Is CRON only for root user
# 1  
Old 05-19-2015
Is CRON only for root user

Hi,

i have question about cron. can we have user based cron file under /var/spool/cron or we should have only root file which can only be accessed by root user or admin and he should only be doing the task of scheduling.

PKS

Last edited by joeyg; 05-19-2015 at 10:39 AM.. Reason: Fixed title.
# 2  
Old 05-19-2015
Hi.

Any user can use cron, depending on how /etc/cron.allow and /etc/cron.deny are configured.

Only root (usually) has direct access to /var/spool/cron, though. Users access their files using the crontab command.

Last edited by Scott; 05-19-2015 at 01:01 PM.. Reason: Added "direct" to clarify the point I was making
# 3  
Old 05-19-2015
Scott,

One thing to keep in mind that editing the files in /var/spool/cron is not recommended, see crontab for further details.

- DL
# 4  
Old 05-19-2015
I didn't see anyone mention editing anything manually.
# 5  
Old 05-19-2015
Just distributing clues. This one was from some recent experience -- had to clean up a mess on many of 'my' systems where a jr. admin was changing permissions of system files and directories to give users "access" - 'cause he didn't know.
This User Gave Thanks to derekludwig For This Post:
# 6  
Old 05-19-2015
To create or edit the cron file of any user from root user. You can use this following command:

# crontab -u <user> -e
If the user wants to create or edit his on cron file by himself (without root user involvement), it is still possible by using this following steps:

Code:
# su - <user>
$ crontab -e

However, as mentioned on the previous post, it is depends on how the /etc/cron.allow and /etc/cron.deny files are configured on your machine.
# 7  
Old 05-19-2015
Quote:
Originally Posted by subrkann
To create or edit the cron file of any user from root user. You can use this following command:

# crontab -u <user> -e
If the user wants to create or edit his on cron file by himself (without root user involvement), it is still possible by using this following steps:

Code:
# su - <user>
$ crontab -e

However, as mentioned on the previous post, it is depends on how the /etc/cron.allow and /etc/cron.deny files are configured on your machine.
That is way too complicated. Any user that is allowed to submit cron jobs can edit their own crontab file with just:
Code:
crontab -e

You don't need special privileges unless you are editing someone else's crontab file.

The crontab utility runs with setUID root privileges so it can create the directory to contain the crontab file, the crontab file, change its owner to the user's UID with group cron, and then reduces privileges to run an editor for the user to update their own crontab file.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

CRON JOB not running - for tape backup from root user

I am trying a cron on root user to backup to tape using TAR command here is the cron entry 11 08 * * 6 /erdhot1cron 2>&1 >> /test3/scripts/dba/erdhot1cron.log here is script inside - edhot1cron #!/bin/bash vsysdt=`date +%d%m%y` date tar -cvf /dev/st0... (4 Replies)
Discussion started by: vijaymec50
4 Replies

2. Shell Programming and Scripting

How to give root access to non root user?

Currently in my system Red Hat is installed. And Many user connect to my machine via SSH Techia Terminal. I want to give some users a root level access. Can anyone please help me how to make it possible. I too searched on the Google but didn't find the correct way Regards ADI (4 Replies)
Discussion started by: adisky123
4 Replies

3. UNIX for Advanced & Expert Users

Root and non-root user not able to delete the file

Hi!! one strange problem occurred with my RHEL 5 box. i'm having logs folder with ownership of non-root user. Created some files with root user under logs folder. here is the scene: -rw-r----- 1 root root 1048227 Feb 28 12:34 SystemOut_13.02.28_12.34.10.log -rw-r----- 1 root root ... (6 Replies)
Discussion started by: sukhdip
6 Replies

4. UNIX for Dummies Questions & Answers

Sudo to delegate permission from non-root user to another non-root user

I've been through many threads before i decide to create a separate thread. I can't really find the solution to my (simple) problem. Here's what I'm trying to achieve: As "canar" user I want to run a command, let's say "/opt/ocaml/bin/ocaml" as "duck" user. The only to achieve this is to... (1 Reply)
Discussion started by: canar
1 Replies

5. Shell Programming and Scripting

Cron job initiating ssh AND sudo (from user, not root)

I've been bashing my head on the desk for 2 days trying to get this to work, but I've had no luck. I'll try to be as clear as possible in my explanation without dragging out the details. I'm trying to set up a cron job for user "john" which runs a script. This script initiates an ssh connection to... (5 Replies)
Discussion started by: eh3civic
5 Replies

6. Solaris

"! bad user (root)" in cron log

I am getting the following error in the cron log: ! bad user (root) Wed Sep 22 14:30:00 2010 < root 8989 c Wed Sep 22 14:30:00 2010 rc=1 What does this mean? (5 Replies)
Discussion started by: jastanle84
5 Replies

7. UNIX for Dummies Questions & Answers

If user has own crontab, results in accumulation of root CRON processes

Hello, I seem to be having a problem with accumulation of root CRON jobs occuring when I have a user's cron job(s) running. Here is an example of a user's crontab file: */1 * * * * echo "hello" > /dev/nullps aux|grep CRON root 14333 0.0 0.0 91236 2172 ? S ... (12 Replies)
Discussion started by: Narnie
12 Replies

8. Solaris

User entry in both cron.allow and cron.deny

Hello All, Anybody please help me to know ,what happens when a user having entry in both cron.allow and cron.deny files.Wheather the user will be able to access the crontab??? Thanks in advance Vaisakh (5 Replies)
Discussion started by: ksvaisakh
5 Replies

9. UNIX for Dummies Questions & Answers

How to allow access to some commands having root privleges to be run bu non root user

hi i am new to unix and i have abig task. i have to \run particular commands having root privileges from a non root user. i know sudo is one of the way but i need sum other approach kindly help Thanks (5 Replies)
Discussion started by: suryashikha
5 Replies

10. Shell Programming and Scripting

root user command in shell script execute as normal user

Hi All I have written one shell script for GPRS route add is given below named GPRSRouteSet.sh URL="www.google.com" VBURL="10.5.2.211" echo "Setting route for $URL for GPRS" URL_Address=`nslookup $URL|grep Address:|grep -v "#"|awk -F " " '{print $2}'|head -1` echo "Executing ... (3 Replies)
Discussion started by: mnmonu
3 Replies
Login or Register to Ask a Question