If I try to (for example) encrypt file with symmetric cypher as root, I get the
following:
gpg --cipher-algo=CAST5 -c etc_2007-10-06.tar.gz
can't connect to `/root/.gnupg/S.gpg-agent': No such file or directory
gpg-agent[9191]: command get_passphrase failed: Operation cancelled
gpg: cancelled by user
gpg: error creating passphrase: Operation cancelled
gpg: symmetric encryption of `etc_2007-10-06.tar.gz' failed: Operation cancelled
No attempt to ask for the password, file stays unencrypted.
If I start gpg-agent --daemon manually as root, the behavior is similar. Here
is output from gpg-agent --daemon --debug-level advanced being run as root:
2007-10-06 16:33:44 gpg-agent[9486] listening on socket
`/tmp/gpg-mYKxIM/S.gpg-agent'
2007-10-06 16:33:52 gpg-agent[9487] handler 0x8090588 for fd 7 started
gpg-agent[9487.7] DBG: -> OK Pleased to meet you
gpg-agent[9487.7] DBG: <- RESET
gpg-agent[9487.7] DBG: -> OK
gpg-agent[9487.7] DBG: <- OPTION ttyname=/dev/pts/0
gpg-agent[9487.7] DBG: -> OK
gpg-agent[9487.7] DBG: <- OPTION ttytype=xterm
gpg-agent[9487.7] DBG: -> OK
gpg-agent[9487.7] DBG: <- OPTION lc-ctype=ru_RU.KOI8-R
gpg-agent[9487.7] DBG: -> OK
gpg-agent[9487.7] DBG: <- OPTION lc-messages=ru_RU.KOI8-R
gpg-agent[9487.7] DBG: -> OK
gpg-agent[9487.7] DBG: <- GET_PASSPHRASE --data -- X X X
п▓п╡п╣п╢п╦я┌п╣+я└я─п╟п╥я┐-п©п╟я─п╬п╩я▄%0A
2007-10-06 16:33:52 gpg-agent[9487] starting a new PIN Entry
2007-10-06 16:33:52 gpg-agent[9487] DBG: connection to PIN entry established
2007-10-06 16:33:53 gpg-agent[9487] command get_passphrase failed: Operation
cancelled
gpg-agent[9487.7] DBG: -> ERR 67108963 Operation cancelled <GPG Agent>
gpg-agent[9487.7] DBG: <- [EOF]
2007-10-06 16:33:53 gpg-agent[9487] handler 0x8090588 for fd 7 terminated
If I run gpg-agent as ordinary user, and pass GPG_AGENT_INFO to gpg being run as
root, everything works correctly.