New answers tagged not-root-user
First, you need some configs for ssh server and ssh client. In Server, in /etc/ssh/sshd_config, make sure you accept TZ variable: AcceptEnv LANG LC_* TZ In Client, in /etc/ssh/ssh_config or ~/.ssh/config, make sure you send TZ variable: SendEnv TZ (The defaults are usually to send none from the client, and accept none on the server.) Then make alias ...
Use the TZ environment variable. E.g.: bash$ export TZ=US/Pacific bash$ date Mon Mar 3 00:31:17 PST 2014 bash$ export TZ=US/Eastern bash$ date Mon Mar 3 03:33:06 EST 2014 The possible values for TZ are in the directory /usr/share/zoneinfo (see, for example, the existence of /usr/share/zoneinfo/US/Pacific)
You need to put your cron entry in /etc/cron.d or /etc/crontab for it to be run as root. If you put it in a new file under /etc/cron.d, that format should work (/etc/crontab uses a slightly different format).
What may have happened is: sudo is caching your password. So, after you've correctly completed the implementation of sudo on your system, you have to enter the password for the first command, and after that it's cached for some time. If that happens and you run the sequence sudo aptitude install sendmail sudo apt-get install sendmail Then you'll have to ...
As variant - create a script (added to crontab) and allow to execute without password http://askubuntu.com/questions/155791/how-do-i-sudo-a-command-in-a-script-without-being-asked-for-a-password
You can allow everyone to call this process in addition to (i.e. independently of) the run caused by cron. Just allow the execution (without password) via sudo, create a wrapper script which does the sudo call and point the users at this script.
Top 50 recent answers are included