On Sun, Jan 04, 2009 at 12:18:32PM -0700, Paul E Condon wrote:
> On Sun, Jan 04, 2009 at 08:38:46PM +0200, Andrei Popescu wrote:
> > On Sun,04.Jan.09, 08:55:27, Paul E Condon wrote:
> > > I'm in the process of converting from nfs to sshfs on my home-grown
> ...
> 
> > 
> > As far as I recall the manpage of ssh-agent has generic instructions on 
> > how to start it.
> > 
> 
> The man page instructions assume that one is running a graphical display
> manager, and I am not. This is precisely why I need help, IMHO.


from memory the example uses pinentry - which handles there being a
graphical display and a ncurses display


I have a startup script which I place in .bash_rc which setups up gpg
agent and ssh agent (seems like the gpg agent can do ssh agent work as
well)



#!/bin/dash

#
# Agent startup scripts

# Set the agents to use
GPGAGENT='/usr/bin/gpg-agent'
SSHAGENT='/usr/bin/gpg-agent'
#SSHAGENT='/usr/bin/ssh-agent'

# Env
GPG_ENV="$HOME/.gnupg/gpg-agent-info-$(hostname)"
SSH_ENV="$HOME/.ssh/environment"

# use gpg-agent to provide ssh-agent functionality
if [ "$GPGAGENT" = "$SSHAGENT" ]
then
        SSHFUNC='--enable-ssh-support'
else
        # if we are starting ssh-agent then don't start ssh support in gpg
        SSHFUNC=''
fi


# Start functions 
startgpgagent() {
        eval `gpg-agent $SSHFUNC --daemon --write-env-file "$GPG_ENV"`
}
        

startsshagent() {
        /usr/bin/ssh-agent -s | grep '^SSH' > "${SSH_ENV}"
        chmod 600 "${SSH_ENV}"
        . "${SSH_ENV}" > /dev/null
}


if [ -x "$GPGAGENT" ]
then

        # From the man page
        GPG_TTY=`tty`
        
        
        if [ -f "$GPG_ENV" ]
        then
                DPID="$(grep GPG_AGENT_INFO $GPG_ENV  | cut -d : -f 2)"
                
                PIDCMD="$(ps -p "$DPID" --no-heading --format comm)"
                if [ "x$PIDCMD" = "xgpg-agent" ]
                then
                        . "$GPG_ENV"
                else
                        startgpgagent
                fi 
                
        else
                startgpgagent
        fi
        
        export GPG_AGENT_INFO 
        export GPG_TTY
        if [ ! -z "$SSHFUNC" ]
        then
                export SSH_AUTH_SOCK
                export SSH_AGENT_PID
        fi

        echo UPDATESTARTUPTTY | gpg-connect-agent >/dev/null

fi

if [ "$GPGAGENT" != "$SSHAGENT" ] && [ -x "$SSHAGENT" ]
then
        # Source SSH settings, if applicable
        if [ -f "${SSH_ENV}" ]; then

                DPID="$(sed -ne 's/^SSH_AGENT_PID=\([^;]*\);.*$/\1/p' 
${SSH_ENV})"
                PIDCMD="$(ps -p "$DPID" --no-heading --format comm)"

                if [ "x$PIDCMD" = "xssh-agent" ]
                then
                        . "${SSH_ENV}" 
                else
                        startsshagent
                fi
        else
             startsshagent
        fi

        export SSH_AUTH_SOCK
        export SSH_AGENT_PID

fi



Also because I have a shared home directory I use hostname in the file
handles pinentry-gtk2 is the package I use (which handles curses entry
as well)


> 
> -- 
> Paul E Condon           
> pecon...@mesanetworks.net
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
> with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
> 
> 

-- 
The secret of happiness is total disregard of everybody.

Attachment: signature.asc
Description: Digital signature

Reply via email to