On Unix-like operating systems, the crontab command opens the cron table for editing. The cron table is the list of tasks scheduled to run at regular time intervals on the system.

  1. Root not allowed to use crontab From: Marius Andreiana [ Date Prev ][ Date Next ] [ Thread Prev ][ Thread Next ] [ Thread Index ] [ Date Index ] [ Author Index ].
  2. Bug 128706 - crontab: You are not allowed to use this. File or directory) open('/etc/cron.deny', O_RDONLY) = -1 ENOENT (No such file or directory) You (thomasz) are not allowed to use this program (crontab) See crontab(1) for more information If the cron.allow file exists, then you must be listed therein in order to be allowed to use this.
  3. After joining a Solaris 10 server to the AD, users are no longer allowed to use crontab command: [bgamblin@ledccdapp1 ~]$ crontab -l You (bgamblin) are not allowed to use this program (crontab).

The daemon which reads the crontab and executes the commands at the right time is called cron. It's named after Kronos, the Greek god of time.

You (root) are not allowed to access to (crontab) because of pam configuration centOS. I restarted crond several times nothing helped. Any help greatly appreciated.

This document covers the GNU/Linux version of crontab.

  • Syntax
  • Overview
  • Configuration
  • Examples

Red Hat You Are Not Allowed To Use This Program Crontab

Syntax

Options

fileLoad the crontab data from the specified file. If file is a dash ('-'), the crontab data is read from standard input.
-uuserSpecifies the user whose crontab is to be viewed or modified. If this option is not given, crontab opens the crontab of the user who ran crontab. Note: using su to switch users can confuse crontab, so if you are running it inside of su, always use the -u option to avoid ambiguity.
-lDisplay the current crontab.
-rRemove the current crontab.
-eEdit the current crontab, using the editor specified in the environment variable VISUAL or EDITOR.
-iSame as -r, but gives the user a yes/no confirmation prompt before removing the crontab.
-sSELinux only: appends the current SELinux security context string as an MLS_LEVEL setting to the crontab file before editing or replacement occurs. See your SELinux documentation for detailed information.

Overview

The crontab command is used to view or edit the table of commands to be run by cron.

Each user on your system can have a personal crontab.

Crontab files are located in /var/spool/ (or a subdirectory such as /var/spool/cron/crontabs), but they are not intended to be edited directly. Instead, they are edited by running crontab.

Cron command entries

Each cron command entry in the crontab file has five time and date fields (followed by a user name, only if it is the system crontab file), followed by a command.

Commands are executed by cron when the minute, hour, and month fields match the current time, and at least one of the two day fields (day of month, or day of week) match the current day.

The cron daemon checks the crontab once every minute.

Note

Nonexistent times, such as 'missing hours' during daylight savings 'Spring forward' days, will never match. This causes jobs scheduled during the 'missing times' not to run during those times. For the same reason, times that occur more than once during daylight savings (in the Autumn) will cause matching jobs to run twice.

Time and date fields

fieldallowed values
minute0-59
hour0-23
day of month1-31
month1-12 (or names; see example below)
day of week0-7 (0 or 7 is Sunday, or use names; see below)
You are not allowed to use this program (crontab) rhel 7

Any of these fields can be set to an asterisk (*), which stands for 'first through last'. For instance, to run a job every month, put * in the Month field.

Ranges of numbers are allowed. Ranges are two numbers separated with a hyphen. The specified range is inclusive; for example, 8-11 for an 'hours' entry specifies execution at hours 8, 9, 10 and 11.

Lists are allowed. A list is a set of numbers (or ranges) separated by commas. Examples: '1,2,5,9', '0-4,8-12'.

Step values can be used in conjunction with ranges. For example, '0-23/2' in the Hours field means 'every other hour.' Steps are also permitted after an asterisk, so if you want to say 'every two hours', you can use '*/2'.

Names can also be used for the 'month' and 'day of week' fields. Use the first three letters of the particular day or month (case doesn't matter). Ranges or lists of names are not allowed.

The 'sixth' field (the rest of the line) specifies the command to be run. The entire command portion of the line, up to a newline or %character, will be executed by /bin/sh or by the shell specified in the SHELL variable of the cronfile. Percent-signs (%) in the command, unless escaped with backslash (), will be changed into newline characters, and all data after the first % will be sent to the command as standard input.

Note that the day of a command's execution can be specified by two fields: day of month, and day of week. If both fields are restricted (in other words, they aren't *), the command will be run when either field matches the current time. For example, '30 4 1,15 * 5' would cause a command to be run at 4:30 am on the 1st and 15th of each month, plus every Friday.

The crontab file

Each line of a crontab file is either 'active' or 'inactive'. An 'active' line is an environment setting, or a cron command entry. An 'inactive' line is anything ignored, including comments.

Blank lines and leading spaces and tabs are ignored. Lines whose first non-space character is a pound-sign (#) are interpreted as comments, and are ignored. Comments are not allowed on the same line as cron commands, because they will be interpreted as part of the command. For the same reason, comments are not allowed on the same line as environment variable settings.

Redhat You Are Not Allowed To Use This Program (crontab)

Environment settings

An environment setting line in the crontab can set environment variables for whenever cron runs a job.

Tip

Not every system's crontab can include environment settings. On Ubuntu and Debian, and systems that use GNU mcron, environment settings can be made in the crontab. On other systems, such as Arch Linux and Fedora, environment settings in the crontab are not allowed. Check your distribution's cron documentation for more information.

An environment setting in the crontab is formatted as:

The spaces around the equal sign (=) are optional, and any subsequent non-leading spaces in value will be part of the value assigned to name. The value string may be placed in quotes (single or double, but matching) to preserve leading or trailing blanks.

Some environment variables are set automatically by cron:

  • SHELL is set to /bin/sh.
  • LOGNAME and HOME are set from the /etc/passwd line of the crontab's owner. HOME and SHELL may be overridden at runtime by settings in the crontab; LOGNAME may not.
  • The LOGNAME variable is sometimes called USER on BSD systems. On these systems, USER will be set also.

Configuration

Permitting users to run cron jobs

Cron jobs can be allowed or disallowed for individual users, as defined in the files /etc/cron.allow and /etc/cron.deny. If cron.allow exists, a user must be listed there to be allowed to use a given command. If the cron.allow file does not exist but the cron.deny file does, then a user must not be listed there to use a given command. If neither of these files exists, only the superuser will be allowed to use a given command.

Cron permissions can also be defined using PAM (pluggable authentication module) authentication to set up users who may or may not use crontab and system cron jobs. PAM configuration is located in /etc/cron.d/.

Configuring the temp directory

The temporary directory for cron jobs can be set in environment variables listed below. If these variables are not defined, the default temporary directory /tmp is used.

Configuration files

FileDescription
/etc/cron.allowIf this file exists, users must be listed in this file to be able to run cron jobs.
/etc/cron.denyIf this file exists, users must not be listed in this file to be able to run cron jobs.

If neither configuration file exists, only the superuser may run cron jobs.

Examples

Running crontab

Edit your crontab.

Display ('list') the contents of your crontab.

Remove your crontab, effectively un-scheduling all crontab jobs.

Edit the crontab of the user named charles. The -u option requires administrator privileges, so the command is executed using sudo.

View the crontab of user jeff.

Remove the crontab of user sandy.

Crontab entries

The following are examples of entries which could be included in a crontab.

Run the shell script /home/melissa/backup.sh on January 2 at 6:15 A.M:

Days and months can be listed by name (Monday) or abbreviation (Jan). Zeroes at the beginning of a number are valid, which can help you make multiple entries line up visually.

ee

For instance, the next example runs the same script as above, at 12:01 AM, every Monday in January:

Run /home/carl/hourly-archive.sh every hour, on the hour, from 9 A.M. (09:00) through 6 P.M. (18:00), every day:

Run /home/wendy/script.sh every Monday, at 9 A.M. and 6 P.M:

Run /usr/local/bin/backup at 10:30 P.M., every weekday:

Related commands

at — Schedule a command to be run at a certain time.

Active6 years, 2 months ago

Here's some output that I hope is helpful:

Problem:

Crontab does not have setguid, and is not in the crontab group.

Solution:

As root...

Nick Bolton
Nick BoltonNick Bolton
2,95612 gold badges43 silver badges60 bronze badges

3 Answers

Does /usr/bin/crontab have the setgid permission set?

Rhel You Are Not Allowed To Use This Program (crontab)

If not, chmod g+s it (and if needed, chownbefore that)

Red Hat You (oracle) Are Not Allowed To Use This Program (crontab)

Edit: Note that this only applies to Vixie Cron (used by most distros); other daemons (such as dcron) may use different permissions (setuid).

grawitygrawity

Redhat 7 You Are Not Allowed To Use This Program (crontab)

Also it's worth checking out the permissions at /var/spool/cron/crontabs by

In my case doing this showed that actually the user assigned to the crontab was 'whoopsie' which I assume means there was some error in setting up the user.

Performing...

Fixed this completely :)

Shane on a bikeShane on a bike

Check for an /etc/cron.allow and /etc/cron.deny file. If those files exist, make sure your user name is in /etc/cron.allow.

ibuysibuys

You (oracle) Are Not Allowed To Use This Program (crontab) Redhat

Not the answer you're looking for? Browse other questions tagged cron or ask your own question.