[ Prev ] [ Index ] [ Next ]

Agent

Created onsdag 23 november 2016


An SSH agent will cache your private-key, so it can be provided to other SSH clients (Git etc).
ssh-agent is the default agent included with OpenSSH.


# Zsh!
# There is a plugin in OMZ, that allows you to easily run a SSH-agent at startup. See Zsh.


Bash

# Below is Bash specific - Zsh has a SSH agent plugin (or is it Oh-My-Zsh? Who cares)


Run the agent

$ eval $(ssh-agent)


Add private key to agent

$ ssh-add ~/.ssh/<private-key>


To start the agent automatically

# Add the following to your ~/.bashrc file.
# This will also make sure, that only one instance of ssh-agent is running.

if ! pgrep -u $USER ssh-agent > /dev/null; then
	ssh-agent > ~/.ssh-agent
fi
if  "$SSH_AGENT_PID" == "" ; then
	eval $(<~/.ssh-agent)
fi