By default, crontab
file protections are set up so
that you cannot inadvertently delete a crontab
file by using
the rm command. Instead, use the crontab -r command
to remove crontab
files.
By default, the crontab -r command removes your own crontab
file.
You do not have to change the directory to /var/spool/cron/crontabs
(where crontab
files are located) to use this command.
How to Remove a crontab
File
Become superuser or assume an equivalent role to remove a crontab
file that belongs to root
or another user. Roles contain
authorizations and privileged commands. For more information about roles, see
Configuring RBAC (Task Map) in System Administration Guide: Security Services
.
You do not need to become superuser or assume an equivalent role to remove your
own crontab
file.
Remove the crontab
file.
$crontab -r
[username
]
where username
specifies the name of the user's account
for which you want to remove a crontab
file. Removing crontab
files for another user requires superuser privileges.
If you accidentally type the crontab command with
no option, press the interrupt character for your editor. This character allows you
to quit without saving changes. If you instead saved changes and exited the file,
the existing crontab
file would be overwritten with an empty
file.
Verify that the crontab
file
has been removed.
# ls /var/spool/cron/crontabs