Welcome to WebmasterWorld Guest from 54.198.23.251

Forum Moderators: bakedjake

Message Too Old, No Replies

allow users crontab access

     
6:10 pm on Oct 8, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 4, 2002
posts:187
votes: 0


I believe only root has access to crontab on my server but I can't figure out how to allow my users to use crontab. cron.allow and cron.deny does not exist so that means only root can use crontab, so how can I allow users to use it?

From root I tried to use "crontab -l username" and "crontab -e username" but it says "crontab: usage error: no arguments permitted after this option" and gives the usages for it.
I tried as the user to pico cron.txt, insert the command and save it and "crontab cron.txt" but says crontab: command not found. Am I supposed to create cron.allow and add users who can use crontab?

Or am I doing it all wrong?

6:47 pm on Oct 8, 2003 (gmt 0)

Preferred Member

10+ Year Member

joined:Sept 28, 2002
posts:505
votes: 0


Hi,
I assume you are on a Linux system.
Then, you have a small syntax error in viewing other users crontabs, try "crontab -l -u username" instead.

Here is how it works:
Two config files, /etc/cron.deny and /etc/cron.allow (on SuSE systems these files are /var/spool/cron/deny and .../allow), specify who can use crontab.
If the allow file exists, then it contains a list of all users that may submit crontabs, one per line. No unlisted user can invoke the crontab command.
If the allow file does not exist, then the deny file is checked.
If neither the allow file nor the deny file exists, only root can submit crontabs.
This seems to be your case, so you should create one of these files ... on my system I have a deny file just containing user "guest", so all others are allowed.

One caveat: this access control is implemented by crontab, not by cron. If a user manages to put a crontab file into the appropriate directory by other means, cron will blindly execute ...

[from the book "Linux Administration Handbook" by Nemeth/Snyder/Hein and validated locally here]

HTH and HAND,
R.

10:06 pm on Oct 8, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 4, 2002
posts:187
votes: 0


"crontab -l -u username" said no crontab exists for that user, but at least I'm getting somewhere now! Creating the file /etc/cron.deny does sound like the way to go. I'm not skilled at this so let me know if this is correct. I'll need to login as root and cd to /etc, then type pico cron.deny and then type in guest on the first line and save it? Then it should allow users to use crontab I hope.

Further inspection of the instructions from the script I'm using doesn't say I have to be logged in as a user, I'm just guessing that what I'm supposed to do. It says from ssh type in "crontab -l > cron.txt" then export the text file and edit it in a text editor, add the command line in it and then import it back in using "crontab cron.txt"

Maybe I'm supposed to be doing this from root anyway. If so that would be much easier.

tmiles81

9:03 pm on Nov 20, 2003 (gmt 0)

Inactive Member
Account Expired

 
 


try crontab -e as the user to create your crontab file.
6:19 pm on Nov 21, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Sept 12, 2002
posts:885
votes: 0


Before using 'crontab -e', you might want to set $VISUAL and/or $EDITOR to point to an editor you like. Otherwise, you are distressingly likely to get dumped into vi, which is absolutely inscrutable to a new user. (This default *does* vary between installations, so you might luck into an editor that is easier for the uninitiated to use.) I don't mean insult vi - it's probably fine and clearly powerful, once you learn to use it, which I never have. I just think it's a bad default for people who might not know how to choose their preferred editor. Heck, I think GNU nano is obnoxious for any serious work, but it makes a good default because newbies have a chance of getting what they want done.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members