This question already has an answer here:
I have a personal username/password on a unix machine with limited privileges. Whenever I need to execute some commands I have to substitute user using the su command, then I execute it normally.
Now, I need to add a cronjob that uses such privileged commands so I added the cronjob on the crontab of the user I substituted to in order to have access to these commands.
Strangely, it turned out to me that these commands fail to run for some reason as a cronjob although when I execute them directly from shell (after su) they work seamlessly.
Why does this happen? Why do these commands not work as part of cronjobs?