Information
If cron is installed in the system, configure /etc/cron.allow to allow specific users to use these services. If /etc/cron.allow does not exist, then /etc/cron.deny is checked. Any user not specifically defined in those files is allowed to use cron. By removing the file, only users in /etc/cron.allow are allowed to use cron.
Note: Even though a given user is not listed in cron.allow cron jobs can still be run as that user. The cron.allow file only controls administrative access to the crontab command for scheduling and modifying cron jobs.
On many systems, only the system administrator is authorized to schedule cron jobs. Using the cron.allow file to control who can run cron jobs enforces this policy. It is easier to manage an allow list than a deny list. In a deny list, you could potentially add a user ID to the system and forget to add it to the deny files.
Solution
-- IF -- Cron is being used to execute batch jobs on the system:
Run the following script to remove /etc/cron.deny create /etc/cron.allow and set the file mode on /etc/cron.allow :
#!/usr/bin/env bash
{
if rpm -q cronie >/dev/null; then
[ -e /etc/cron.deny ] && rm -f /etc/cron.deny
[ ! -e /etc/cron.allow ] && touch /etc/cron.allow
chown root:root /etc/cron.allow
chmod u-x,go-rwx /etc/cron.allow
else
echo "cron is not installed on the system"
fi
}
OR Run the following command to remove cron :
# dnf remove cronie