Bug 54119 - 'crontab -r' is very harmfull
Summary: 'crontab -r' is very harmfull
Status: CLOSED DUPLICATE of bug 35985
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: vixie-cron
Version: 7.1
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Jens Petersen
QA Contact: Brock Organ
Depends On:
TreeView+ depends on / blocked
Reported: 2001-09-27 18:17 UTC by Oliver Schulze L.
Modified: 2007-04-18 16:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Last Closed: 2002-08-14 10:01:11 UTC

Attachments (Terms of Use)

Description Oliver Schulze L. 2001-09-27 18:17:43 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; es-ES; rv:0.9.2)
Gecko/20010726 Netscape6/6.1

Description of problem:
The -r option in the command crontab is really harmfull. It does not ask
for a confirmation and does not create a backup file.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. crontab -r

Actual Results:  Your crontab is deleted with no warning

Expected Results:  A warning message should be fine, asking you to press
'Y' to delete the crontab.

Additional info:

The crontab configuration file is a really important file, and there is a
really small probability that you may want to delete a crontab in a full
production server in all your lifetime.
Let me say: "crontab -r is evil"

Comment 1 Oliver Schulze L. 2001-09-27 18:27:29 UTC
Another problem is that the 'E' key is next to the 'R' key.
The 'E' key is most used option in crontab,
while the 'R' is most harmfull option that you can use in crontab.

Comment 2 Michael A. McLean 2001-11-05 17:37:46 UTC
# crontab -l >crontab.save
# vi crontab.save
# crontab crontab.save

The "L" key is nowhere near the "R" key.

There are other ways that crontabs can be lost, so it is nice to make a habit of
keeping a backup this way.

Comment 3 Eido Inoue 2002-02-12 19:10:10 UTC
Hmmm. Not to be flippant over your loss, but there's lots of ways you can mess
things up by typing a wrong option. "rm -f" is very close to rm -r on a QWERTY
keyboard for example.

I'm not going to change this because then we'd have to bulletproof the whole
shell command line system.

You can use "alias" to protect yourself much like dangerous commands such as
"rm" and "mv" are aliased to interactive confirmation equivalents.

Comment 4 Oliver Schulze L. 2002-02-13 05:34:59 UTC
The very big diference between rm and crontab is that crontab does not provides
an interactive option.
In rm, alias rm="rm -i" should work, but in crontab you don't have this option.
And since crontab -r is so harmfull, and does not provides an "-i" option, there
should be a warning message and a confirmation should be asked.

Another thing you can say is: "You should make backups of your crontabs", but I
think that is a lot easier to make a "Are you sure you want to delete your
crontab" message, than search for your tape backup and restore your crontab copy.

Please don't get me wrong, I'm not lazy, I just want Linux to be more friendly.
So, the options "-f" and "-i" (as in rm) should be be available in crontab.

Comment 5 Jens Petersen 2002-08-14 10:40:39 UTC

*** This bug has been marked as a duplicate of 35985 ***

Note You need to log in before you can comment on or make changes to this bug.