Skip to content

Instantly share code, notes, and snippets.

@plembo
Last active May 25, 2023 07:36
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save plembo/0babff5e76e87f8d71442b5b76563645 to your computer and use it in GitHub Desktop.
Save plembo/0babff5e76e87f8d71442b5b76563645 to your computer and use it in GitHub Desktop.
crontab says fopen: permission denied

When crontab gives fopen: permission denied error

While trying to open my user's crontab on Ubuntu, the system barked back:

$ crontab -l
crontabs/myuser/: fopen: Permission denied

This is due to improper permissions on crontab executable.

To fix:

$ sudo chown root:crontab /usr/bin/crontab
$ sudo chmod 2755 /usr/bin/crontab

Mucked up perms:

rwxr-xr-x 1 root root 39352 Nov 16  2017 /usr/bin/crontab

After fix:

-rwxr-sr-x 1 root crontab 39352 Nov 16  2017 /usr/bin/crontab

Solution from Ask Ubuntu: cannot access crontab after changing uid.

@YiweiJiang2015
Copy link

Great, it solves my problem.

@matthannan1
Copy link

Thank you!

@bumipl
Copy link

bumipl commented May 25, 2023

Solved mine too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment