Bug 54119 - 'crontab -r' is very harmfull
'crontab -r' is very harmfull
Status: CLOSED DUPLICATE of bug 35985
Product: Red Hat Linux
Classification: Retired
Component: vixie-cron (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jens Petersen
Brock Organ
: FutureFeature
Depends On:
  Show dependency treegraph
Reported: 2001-09-27 14:17 EDT by Oliver Schulze L.
Modified: 2007-04-18 12:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-08-14 06:01:11 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Oliver Schulze L. 2001-09-27 14:17:43 EDT
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 14:27:29 EDT
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 12:37:46 EST
# 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 14:10:10 EST
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 00:34:59 EST
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 06:40:39 EDT

*** 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.