Which environment variables are used by ssh-agent?

Which environment variables are used by ssh-agent? (Please select TWO variables)

Which environment variables are used by ssh-agent? (Please select TWO variables)

A.
SSH_AGENT_KEY

B.
SSH_AGENT_SOCK

C.
SSH_AGENT_PID

D.
SSH_AUTH_SOCK

E.
SSH_AUTH_PID



Leave a Reply 3

Your email address will not be published. Required fields are marked *


Ronaldo SB

Ronaldo SB

This brings SSH_AUTH_SOCK and SSH_AGENT_PID as environment variables into the current shell.

joe

joe

Correct:

C, D

Ektoras

Ektoras

Ronaldo and Joe are correct, here i post an example of the enviroment variable

# set environment variables if user’s agent already exists
SSH_AUTH_SOCK=$(ls -l /tmp/ssh-*/agent.* 2> /dev/null | grep $(whoami) | awk ‘{print $9}’)
SSH_AGENT_PID=$(echo $SSH_AUTH_SOCK | cut -d. -f2)
[ -n “$SSH_AUTH_SOCK” ] && export SSH_AUTH_SOCK
[ -n “$SSH_AGENT_PID” ] && export SSH_AGENT_PID

# start agent if necessary
if [ -z $SSH_AGENT_PID ] && [ -z $SSH_TTY ]; then # if no agent & not in ssh
eval `ssh-agent -s` > /dev/null
fi

# setup addition of keys when needed
if [ -z “$SSH_TTY” ] ; then # if not using ssh
ssh-add -l > /dev/null # check for keys
if [ $? -ne 0 ] ; then
alias ssh=’ssh-add -l > /dev/null || ssh-add && unalias ssh ; ssh’
if [ -f “/usr/lib/ssh/x11-ssh-askpass” ] ; then
SSH_ASKPASS=”/usr/lib/ssh/x11-ssh-askpass” ; export SSH_ASKPASS
fi
fi
fi