MrGibbage wrote: > I get errors like this when I run sa-update from cron > > /usr/local/bin/setlock -n /tmp/cronlock.4051759.53932 sh -c > $'/home/skipmorrow/bin/sa-update --gpgkey 6C6191E3 --channel > sought.rules.yerp.org' > > gpg: WARNING: unsafe ownership on homedir > `/home/skipmorrow/etc/mail/spamassassin/sa-update-keys' > gpg: failed to create temporary file > `/home/skipmorrow/etc/mail/spamassassin/sa-update-keys/.#lk0x5d7320.ps11651.23686': > Permission denied > gpg: keyblock > resource`/home/skipmorrow/etc/mail/spamassassin/sa-update-keys/secring.gpg': > general error > gpg: failed to create temporary file > `/home/skipmorrow/etc/mail/spamassassin/sa-update-keys/.#lk0x5d7320.ps11651.23686': > Permission denied > gpg: keyblock resource > `/home/skipmorrow/etc/mail/spamassassin/sa-update-keys/pubring.gpg': general > error > gpg: no writable keyring found: eof > gpg: error reading > `/home/skipmorrow/share/spamassassin/sa-update-pubkey.txt': general error > gpg: import from > `/home/skipmorrow/share/spamassassin/sa-update-pubkey.txt' failed: general > error > > But when I run it from a login shell, it doesn't show those errors. So I > wrote a cript to verify that the cron job is running as the correct user by > putting in whoami, and indeed it is running as skipmorrow > > skipmor...@ps11651:~$ ls etc/mail/spamassassin/sa-update-keys/ -la > total 28 > drwx------ 2 skipmorrow pg2222652 4096 Jul 20 00:00 . > drwxr-xr-x 3 skipmorrow pg2222652 4096 Jul 17 13:29 .. > -rw------- 1 skipmorrow pg2222652 5123 Jul 17 14:29 pubring.gpg > -rw------- 1 skipmorrow pg2222652 4505 Jul 17 13:32 pubring.gpg~ > -rw------- 1 skipmorrow pg2222652 0 Jul 17 13:29 secring.gpg > -rw------- 1 skipmorrow pg2222652 1200 Jul 17 13:29 trustdb.gpg > skipmor...@ps11651:~$ ls .gnupg/ -la > total 24 > drwx------ 2 skipmorrow pg2222652 4096 Jul 10 13:27 . > drwxr-x--x 30 skipmorrow pg2222652 4096 Jul 20 03:48 .. > -rw------- 1 skipmorrow pg2222652 4128 Jul 10 13:27 pubring.gpg > -rw------- 1 skipmorrow pg2222652 3039 Jul 10 13:27 pubring.gpg~ > -rw------- 1 skipmorrow pg2222652 0 Jul 10 13:27 secring.gpg > -rw------- 1 skipmorrow pg2222652 1200 Jul 10 13:27 trustdb.gpg > > should sa-update be looking for keys in ~/.gnupg? No, it should not be looking in .gnupg. That would be the location for keys you use. The keys used by sa-update are application specific, so why would you want them on the keyring you use for email?
> Or is it working correctly? Well, it's not working correctly, as you're having errors :) > What environment variable does sa-learn and gnupg look for that > would be present in my login shell but not be present when running in a cron > environment? > I don't think it's missing an enviornment variable. Are you sure the cronjob is running with an effective userid of skipmorrow? This message: gpg: failed to create temporary file `/home/skipmorrow/etc/mail/spamassassin/sa-update-keys/.#lk0x5d7320.ps11651.23686': Permission denied Strongly suggests you've got a permissions issue, where the cronjob is running as a user that can't create files in /home/skipmorrow/etc/mail/spamassassin/sa-update-keys/ . Since skipmorrow has rwx, that suggests the cronjob is running as some other userid (probably "cron" or some other system account).
