Posted by Brian @ 9:48 am on October 3rd 2009

How to fix the crontab: no changes made to crontab error using VIM in Linux

I recently upgraded vi to vim on one of my servers and was puzzled why changes weren’t being saved when I edited my crontab file using crontab -e. I would make changes to the file, save them, but still get this error:

crontab: no changes made to crontab

I found a lot of unhelpful advice from checking permissions on the files and directories, to using different editors, to checking cron.allow and cron.deny. None of those worked.

It turns out that .vimrc needs to have a one line configuration option set. You’ll find .vimrc in your home directory (/root for superuser). Just add this line:

set backupcopy=yes

and you’re on your way.