By default, crontab file protections are set up such 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.
Before You Begin
Become an administrator to remove a crontab file that belongs to root or another user. Roles contain authorizations and privileged commands. For more information, see Using Your Assigned Administrative Rights in Securing Users and Processes in Oracle Solaris 11.4.
You do not need to assume the root role to remove your own crontab file.
# crontab -r [username]
where username specifies the name of the user's account for which you want to remove a crontab file. To remove crontab files for another user, assume the root role.
Caution - If you accidentally type the crontab command with no option, press the interrupt character for your editor to quit without saving changes. If you instead save changes and exit the file, the existing crontab file will be overwritten with an empty file.
# ls /var/spool/cron/crontabs
The following example shows how user dsmith uses the crontab -r command to remove his own crontab file.
$ ls /var/spool/cron/crontabs adm jdoe root dsmith sys uucp $ crontab -r $ ls /var/spool/cron/crontabs adm jdoe root sys uucp