[ic] gpg encryptor FAQ problem. Problem Solution included butalso a new question.

Kestutis Lasys kestutis.lasys@delfi.lt
Fri, 23 Feb 2001 14:01:34 +0200


Boyd Lynn Gerber wrote:
> 
> 
> Thanks, I guess I was really tired at 4:00 A.M.  I had 2>/dev/null and I
> could not figure out why I was not dumping the errors to a file.  Below is
> what I have to use.
> 
> ENCRYPTOR       /usr/local/bin/gpg -e -a -q --batch --no-tty --always-trust -r people@signaturebooks.com 2>encrypt.error        Payment
> 
> and it give me an error if interchange is started by root using
> 
> su interch -c "/usr/local/interchange/bin/interchange -r -u"
> 
> A ps -ef shows interch is the interchange user, but I get this message.
> 
> gpg: //.gnupg/secring.gpg: can't create keyring: Permission denied
> gpg: keyblock resource `//.gnupg/secring.gpg': file open error
> gpg: people@signaturebooks.com: skipped: public key not found
> gpg: [stdin]: encryption failed: public key not found
> 
> but if I start interchange after I have logged in as interch not su, it
> works.
> 
> su - interch -c "/usr/local/interchange/bin/interchange -r -u"
> 
> Does not work.  It does not read/use the .profile of the interch.  I get
> errors about DBI that do not show if I start interchange after I have
> logged in.
> 
> The solution was to login as the interch user and start interchange.  Now
> I just have to figure out how to get this to work when I restart the
> machine.  My normal /etc/rc2.d/S99interchange does not work.
> 
> ----------------------------S99interchange------------------------------
> #!/bin/sh
> # interchange deamon start/stop script.
> 
> # Usually this is put in /etc/rc2.d
> # When this is done the interchange server will be started when the
> # machine is started.
> 
> LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:/usr/ccs/lib:/usr/local/mysql/lib/mysql:/usr/local/BerkeleyDB3.2:;export LD_LIBRARY_PATH
> PATH=/sbin:/usr/bin:/usr/sbin:/bin
> basedir=/usr/local/interchange
> bindir=/usr/local/interchange/bin
> export PATH
> 
> mode=$1
> 
> # Safeguard (relative paths, core dumps..)
> cd $basedir
> 
> case "$mode" in
>   'start')
>     # Start deamon
> 
>     if test -x $bindir/interchange
>     then
>       # -l means start with log.
>         /bin/su interch -c "$bindir/interchange"
>     else
>       echo "Can't execute $bindir/interchange"
>     fi
>     ;;
> 
>   'stop')
>     # Stop deamon
>     $bindir/interchange --kill 9
>     ;;
> 
>   *)
>     # usage
>     echo "usage: $0 start|stop"
>     exit 1
>     ;;
> esac
> ------------------------------cut here----------------------------------
> 
> Any ideas on how to change the above to fix the problem or restart
> interchange without logging in as user interch?
> 
> Thanks,
> 
> --
> Boyd Gerber <gerberb@zenez.com>
> ZENEZ   3748 Valley Forge Road, Magna Utah  84044
> Office 801-250-0795 FAX 801-250-7975
> 
> _______________________________________________
> Interchange-users mailing list
> Interchange-users@lists.akopia.com
> http://lists.akopia.com/mailman/listinfo/interchange-users

Try add --homedir option to GnuPG: 
ENCRYPTOR       /usr/local/bin/gpg -e -a -q --batch --homedir
<path_where_your_keys_ring_is> ...

Then you don't relay on environment.


Kestutis Lasys