SSH Agent (Linux): Unterschied zwischen den Versionen

Aus Tutorials
Zur Navigation springen Zur Suche springen
Zeile 29: Zeile 29:
eval $(ssh-agent -k)
eval $(ssh-agent -k)
</pre>
</pre>
==== Links ====
[https://docs.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent https://docs.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent]


=== Automatisieren ===
=== Automatisieren ===
Zeile 60: Zeile 64:
fi
fi
</pre>
</pre>
==== Links ====


[https://stackoverflow.com/questions/18880024/start-ssh-agent-on-login https://stackoverflow.com/questions/18880024/start-ssh-agent-on-login]
[https://stackoverflow.com/questions/18880024/start-ssh-agent-on-login https://stackoverflow.com/questions/18880024/start-ssh-agent-on-login]
=== Links ===
[https://docs.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent https://docs.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent]


== Login über mehrere Rechner ==
== Login über mehrere Rechner ==

Version vom 5. Juli 2020, 09:05 Uhr

Noch in Bearbeitung


Installation

Erstellen von asymmetrischen Schlüsseln siehe SSH per Key

Verwendung

Kommandos

Starten:

eval $(ssh-agent -s)

Schlüssel auflisten:

ssh-add -l

Schlüssel hinzufügen:

ssh-add ~/.ssh/id_rsa

Stoppen:

eval $(ssh-agent -k)

Links

https://docs.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

Automatisieren

vi ~/.bash_profile
SH_ENV="$HOME/.ssh/agent-environment"

function start_agent {
  echo "Initialising new SSH agent..."
  /usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
  echo succeeded
  chmod 600 "${SSH_ENV}"
  . "${SSH_ENV}" > /dev/null
  /usr/bin/ssh-add;
}

# Source SSH settings, if applicable

if [ -f "${SSH_ENV}" ]; then
  . "${SSH_ENV}" > /dev/null
  #ps ${SSH_AGENT_PID} doesn't work under cywgin
  ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
    start_agent;
  }
else
  start_agent;
fi

Links

https://stackoverflow.com/questions/18880024/start-ssh-agent-on-login

Login über mehrere Rechner

Wenn man sich von Rechner zu Rechner verbindet, dann wird der Key nicht automatisch mit übertragen. Dies kann man jedoch durch Editieren der Datei

vi ~/.ssh/config

und hinzufügen von

ForwardAgent yes

festlegen.

Links

https://wiki.ubuntuusers.de/SSH/


Zurück zu Ubuntu, SSH Client