I get a permission denied error in account

new time poster here.

So I have discovered the potential of crontab (I installed Linux in May, so a new guy when it comes to Linux, but I have gotten used to it and started using themes about a week ago) today, and after reading a tutorial decided it useful for my workflow and have had trouble saving it. I got a permission denied error when trying to save it in /var/spool/cron/crontabs/.

The full error was
[Error writing /var/spool/cron/crontabs/cronstuff: Permission Denied] after trying to save a document in the built-in editor with terminal (forgot which one but know I selected the first option after being prompted to chose an editor to make the crontab document with.)

EDIT: I get the same error saving to /etc/

Sequence up to error: crontab -e, add info I want it to do, Ctrl O, rename file to /var/spool/cron/crontabs/cronstuff, yes, I want to save the file as a different name, [Error writing /var/spool/cron/crontabs/cronstuff: Permission Denied]

Any help here?

thanks

8

1 Answer

The normal way to create a crontab file that automatically is placed in the /var/spool/cron/crontabs/ directory is by invoking the command crontab -e. Then a file is created in that directory with the same name as your username. From the error message it seems to me that you tried to save the file with the name cronstuff or maybe invoked the editor with crontab -e cronstuff. The system then looks for a user with the name cronstuffand refuses to save the file as there is no such user.

You need to be root when placing a crontab file for another user but not to place one for yourself. If you want to create a crontab file that is not meant for a user then, as root, create a crontab file with (almost) any name and place it in /etc/cron.d, /etc/ /etc/ /etc/ or /etc/ depending on its use. See the crontab howto at Ubuntu documentation pages.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like