Skip to content

Instantly share code, notes, and snippets.

@lohithn4
Forked from plembo/crontab-perm-denied.md
Created March 18, 2021 02:55
Show Gist options
  • Save lohithn4/69b7b6ba9e00dc10c073cc1ab2ed769a to your computer and use it in GitHub Desktop.
Save lohithn4/69b7b6ba9e00dc10c073cc1ab2ed769a to your computer and use it in GitHub Desktop.

Revisions

  1. @plembo plembo revised this gist May 9, 2019. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions crontab-perm-denied.md
    Original file line number Diff line number Diff line change
    @@ -24,3 +24,5 @@ After fix:
    ```bash
    -rwxr-sr-x 1 root crontab 39352 Nov 16 2017 /usr/bin/crontab
    ```

    Solution from [Ask Ubuntu: cannot access crontab after changing uid](https://askubuntu.com/questions/710671/cannot-access-crontab-after-changing-uid).
  2. @plembo plembo revised this gist May 9, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions crontab-perm-denied.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # Getting fopen: permission denied from crontab
    # When crontab gives fopen: permission denied error

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

    ```bash
    $ crontab -l
  3. @plembo plembo renamed this gist May 9, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. @plembo plembo created this gist May 9, 2019.
    26 changes: 26 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    # Getting fopen: permission denied from crontab

    When trying to open my user's crontab on Ubuntu got:

    ```bash
    $ crontab -l
    crontabs/myuser/: fopen: Permission denied
    ```
    This is due to improper permissions on crontab executable.

    To fix:

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

    Mucked up perms:
    ```bash
    rwxr-xr-x 1 root root 39352 Nov 16 2017 /usr/bin/crontab
    ```

    After fix:
    ```bash
    -rwxr-sr-x 1 root crontab 39352 Nov 16 2017 /usr/bin/crontab
    ```