crontab -r deletes cron entries without asking for confirmation

Bug #1451286 reported by Anonymous
28
This bug affects 5 people
Affects Status Importance Assigned to Milestone
cron (Debian)
New
Unknown
cron (Ubuntu)
Fix Released
High
Georges Khaznadar

Bug Description

type: crontab -r

Expected use case : should ask user if they really want to delete this file, of which there are no backups on the system by default, and may take hours to restore by hand, if it's even possible.

what happens: user's cron entry is deleted with no warning.

Tags: patch
Revision history for this message
Christian Decker (decker-christian) wrote :

Hallo Anonymous,

there are a crontab for the system and a crontab for each user. You can make your entries to /etc/crontab and have to be root to edit and remove.
To save your "user" crontab I think you have to back it up.

Greets

Changed in cron (Ubuntu):
status: New → Invalid
Revision history for this message
Anonymous (reason) wrote :

Telling the user to manually back up a file because the program might delete it with no warning is NOT a good solution.

Totally ignored, and marked invalid. Typical.

Revision history for this message
Christian Kastner (ckk) wrote :

This is a valid request. I've linked this bug to the corresponding bug in Debian's cron.

Changed in cron (Ubuntu):
status: Invalid → Confirmed
Changed in cron (Debian):
status: Unknown → New
Revision history for this message
Akiva (bloch-akiva) wrote :

I just wanted to mention that on many keyboards the letters e and r are adjacent and that "crontab -e" is a very common command.
this increases the risk that someone might mistakenly delete his user crontab while trying to edit it

Revision history for this message
Akiva (bloch-akiva) wrote :

set the default behaviour of deleting a crontab to be prompt (and enable suppressing this with -I)

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "crontab_patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Changed in cron (Ubuntu):
importance: Undecided → High
Revision history for this message
Terence Eden (i41bk-launchpad-net) wrote :
Revision history for this message
Akiva (bloch-akiva) wrote : Re: [Bug 1451286] Re: crontab -r deletes cron entries without asking for confirmation

These are only the ones stubborn enough to.complain. there are so.many
others...

On Sat, Jul 27, 2019, 10:53 PM Terence Eden <email address hidden>
wrote:

> Here's a whole bunch of people who have accidentally run `-r` when they
> meant `e` (including me!)
>
> * https://twitter.com/search?q=crontab%20e%20r&src=typed_query
> *
> https://stackoverflow.com/questions/37852940/how-recover-deleted-crontab-r-option
> *
> https://www.reddit.com/r/linux/comments/5h1bh5/psa_do_not_type_crontab_r_when_you_mean_crontab_e/
> *
> https://b3z13r.wordpress.com/2011/02/09/how-to-rebuild-crontab-from-scratch-after-accidentally-typing-crontab-r/
>
> Please can someone to implement the attached patch.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1451286
>
> Title:
> crontab -r deletes cron entries without asking for confirmation
>
> Status in cron package in Ubuntu:
> Confirmed
> Status in cron package in Debian:
> New
>
> Bug description:
> type: crontab -r
>
> Expected use case : should ask user if they really want to delete this
> file, of which there are no backups on the system by default, and may
> take hours to restore by hand, if it's even possible.
>
> what happens: user's cron entry is deleted with no warning.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/ubuntu/+source/cron/+bug/1451286/+subscriptions
>

Revision history for this message
Anonymous (reason) wrote :

I'm glad my initial stubborness is leading to this avalanche of users echoing me. I feel all your pain, I have been there and it sucks!

I would suggest this update/patch needs to go into not only the new versions of Ubuntu, but also the LTS distribution repos also, as a stability bugfix.

I made a ticket in the Mint repos about the bug called systemd and they insta-banned me, lol. I still run Ubuntu 14.04 because I am not interesting in running systemd as pid1, or at all. I'll probably be off to slackware soon.

It's been real, Ubuntu.

Revision history for this message
Eugene Savitsky (eugene-savitsky) wrote :

Just accidentally hit it.... Very big crontab. Thanks God I just yesterday made a backup.

www@weare:/home/eugene$ crontab -r
www@weare:/home/eugene$ crontab -e
no crontab for oxwww - using an empty one
No modification made

Revision history for this message
Anonymous (reason) wrote :

Hasn't this been fixed and pushed into repos yet? I thought it was a confirmed bug with an easy fix? I'd like to see this fix backported to LTS and even previous ubuntu versions, like 14.04.

Revision history for this message
Vasil Sarbinsky (batcila) wrote :

Just accidentally hit it on a production machine :/ Recreated the cron config using the system logs.

Revision history for this message
Georges Khaznadar (georgesk) wrote :

this bug is fixed for a long time, in Debian. Closing the bug report

Changed in cron (Ubuntu):
status: Confirmed → Fix Released
assignee: nobody → Georges Khaznadar (georgesk)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.