cannot access crontab after changing uid

Solution 1:

Your permissions are incorrect for the crontab file. What it should be is like the following:

-rwxr-sr-x 1 root crontab 35984 Feb  9  2013 /usr/bin/crontab

To set your crontab to the above permissions, first change the ownership:

sudo chown root:crontab /usr/bin/crontab

Then set the permissions:

sudo chmod 2755 /usr/bin/crontab

That should set your crontab to the correct permissions to run.

EDIT:

Also, take a look at the /var/spool/cron/crontabs/ folder, you should see something similar to the following:

terrance@terrance-ubuntu:~$ sudo ls -al /var/spool/cron/crontabs/
total 16
drwx-wx--T 2 root     crontab 4096 Dec 17 22:08 .
drwxr-xr-x 3 root     root    4096 Dec  1 07:24 ..
-rw------- 1 root     crontab 1185 Dec 17 22:08 root
-rw------- 1 terrance crontab 1130 Dec 17 21:47 terrance

Pay attention to your username. If it doesn't have the proper ownership, change it by typing in the following:

sudo chown username:crontab /var/spool/cron/crontabs/username

And if permissions need to be set on that file:

sudo chmod 600 /var/spool/cron/crontabs/username

Hope this helps!