In the task we have to allow crontab access to one user and deny to another. I created cron.allow and cron.deny in /etc/cron.d/ directory and added respective user names and restarted the crond service. Task is still failing. Am I missing something? These are the commands I used:
id siva
uid=1002(siva) gid=1002(siva) groups=1002(siva)
id jerome
uid=1003(jerome) gid=1003(jerome) groups=1003(jerome)
sudo su
systemctl status crond.service
● crond.service - Command Scheduler
Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2023-07-31 12:16:38 UTC; 6min ago
ls /etc/cron.d/
0hourly
touch /etc/cron.d/cron.deny
touch /etc/cron.d/cron.allow
ls /etc/cron.d/
0hourly cron.allow cron.deny
vi /etc/cron.d/cron.allow
vi /etc/cron.d/cron.deny
cat /etc/cron.d/cron.allow
siva
cat /etc/cron.d/cron.deny
jerome
systemctl restart crond.service
systemctl status crond.service
● crond.service - Command Scheduler
Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; vendor preset: enabled)
Active: active (running)
hello pls i need help i added usernames i still failed.
ALLOW/DENY Crontab access to users
ssh tony@stapp02
id john
id garrett
sudo -i
systemctl status crond.service
ls /etc/cron.d/
touch /etc/cron.d/cron.deny
touch /etc/cron.d/cron.allow
ls /etc/cron.d/
vi /etc/cron.d/cron.allow
usernames john
vi /etc/cron.d/cron.deny
usernames garrett
cat /etc/cron.d/cron.allow
cat /etc/cron.d/cron.deny
systemctl restart crond.service
systemctl status crond.service
You have same mistake. You must put usernames in /etc/cron.allow and /etc/cron.deny respectively.
Not in /etc/cron.d/cron.allow and /etc/cron.d/cron.deny.