I have had several Debian servers and always edited cronjobs in this way:
crontab -e and Ctrl+x
Just got a new server and can not do it in this way anymore.
When I enter crontab -e, the file opens but I can't write anything. I can move cursor up and down but can't write. I even can not exit from this file because Ctr+x doesn't work.
When I open a file there is some information and the rest empty lines contain tildes ~ in the beginning of each line.
Any ideas how can I edit this file?
Thanks.
To verify if a specific user can access the crontab command, use the crontab -l command while you are logged into the user account. Either this user either is listed in the cron. allow file (if the file exists), or the user is not listed in the cron. deny file.
When you create a crontab file, it is automatically placed in the /var/spool/cron/crontabs directory and is given your user name. You can create or edit a crontab file for another user, or root, if you have superuser privileges.
As one other person has suggested, vim is obviously the default editor on your new server. You can test this by running
EDITOR=pico crontab -e
Substituting whatever is your actual preferred editor (sounds like it may be nano or pico). If that works, you should try one of the following:
update-alternatives --config sensible-editor
You can then choose the default editor for all users (they can override it individually by doing option 1).
You need to turn on insert mode. After entering crontab -e
, press i to turn on insert, enter your full line, press esc to finish entering, and then hold down shift and press z twice to save the file. This is how I managed to do it in vi/vim
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With