Can't enter passphrase in su session.
Steven W. Orr
steveo at syslang.net
Thu May 21 19:19:44 CEST 2009
On Wednesday, May 20th 2009 at 17:36 -0000, quoth Chris Babcock:
=>On Wed, 20 May 2009 20:00:42 +0100
=>mike _ <arizonagroovejet at gmail.com> wrote:
=>
=>> Can anyone offer any insight in this issue?
=>
=>http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html
=>
=>In .bash_profile, you will have something *like* this:
=>if test -f $HOME/.gpg-agent-info && kill -0 `cut -d: -f 2 $HOME/.gpg-agent-info`\
=>2>/dev/null; then
=> GPG_AGENT_INFO=`cat $HOME/.gpg-agent-info`
=> export GPG_AGENT_INFO
=>else
=> eval `/usr/bin/gpg-agent --daemon`
=> echo $GPG_AGENT_INFO >$HOME/.gpg-agent-info
=>fi
=>
=>You *may* have something like this:
=>
=>if [ -f /etc/bashrc ]; then
=> . /etc/bashrc
=>fi
=>
=>
=>The code to launch gpg-agent needs to be in .bashrc if you want it to
=>execute for su users. If your .bash_profile executes your .bashrc as
=>above then you can remove the definition from .bash_profile.
This topic is getting far more complicated than you might expect. Setting
environment variables needs to be done from your .bash_profile . It
happens once when you log in and all child processes inherit the resulting
variables.
If you use su then you do not go through the .bash_profile unless you use
the - option. i.e., "su - bob" will go through bob's .bash_profile but
"su bob" will only go through the .bashrc .
The same is true of ssh. If you ssh to a host to create a session then you
will go through the .bash_profile but if you ssh to a host to just execute
a command then you will only go through the .bashrc .
The proper way to deal with this is to:
* Source in your .bashrc from your .bash_profile
* Set all of your environment variables in your .bash_profile
* Check in your .bashrc to see if PS1 is set. If not then you are not in
an interactive session and you need to set critical environment variables.
Usually PATH is the only one you need to set.
if [[ -n "${PS1}" ]]
then
: Do interactive stuff. Set aliases and variables, etc.
else
. ~/.bash_pathset
fi
--
Time flies like the wind. Fruit flies like a banana. Stranger things have .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net
More information about the Gnupg-users
mailing list