20,290
edits
mNo edit summary |
|||
Line 16: | Line 16: | ||
=== How to Start an SSH Agent === | === How to Start an SSH Agent === | ||
To start an SSH agent on your host machine, open a terminal and execute: | To start an SSH agent on your host machine, open a terminal and execute: | ||
<syntaxhighlight lang=bash> | <syntaxhighlight lang="bash"> | ||
eval "$(ssh-agent -s)" | eval "$(ssh-agent -s)" | ||
</syntaxhighlight> | </syntaxhighlight> | ||
To add your SSH private key to the agent, use: | To add your SSH private key to the agent, use: | ||
<syntaxhighlight lang=bash> | <syntaxhighlight lang="bash"> | ||
ssh-add ~/.ssh/id_rsa | ssh-add ~/.ssh/id_rsa | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 30: | Line 30: | ||
Start automatically your ssh agent with every session by adding the following to your shell init script ('''~/.bashrc''', '''~/.zshrc''', etc...): | Start automatically your ssh agent with every session by adding the following to your shell init script ('''~/.bashrc''', '''~/.zshrc''', etc...): | ||
<syntaxhighlight lang=bash> | <syntaxhighlight lang="bash"> | ||
eval "$(ssh-agent -s)" | eval "$(ssh-agent -s)" | ||
ssh-add ~/.ssh/id_rsa | ssh-add ~/.ssh/id_rsa | ||
Line 36: | Line 36: | ||
Alternatively, you have the option to utilize the '''ssh-add''' command without specifying a particular key, thus instructing it to add all of your keys to the agent. | Alternatively, you have the option to utilize the '''ssh-add''' command without specifying a particular key, thus instructing it to add all of your keys to the agent. | ||
<syntaxhighlight lang=bash> | <syntaxhighlight lang="bash"> | ||
eval "$(ssh-agent -s)" | eval "$(ssh-agent -s)" | ||
ssh-add | ssh-add | ||
Line 59: | Line 59: | ||
When initiating an SSH connection to the embedded platform, use the '''-A''' option with the ssh command: | When initiating an SSH connection to the embedded platform, use the '''-A''' option with the ssh command: | ||
<syntaxhighlight lang=bash> | <syntaxhighlight lang="bash"> | ||
ssh -A user@embedded_platform | ssh -A user@embedded_platform | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 70: | Line 70: | ||
If you use an SSH configuration file for storing common hosts such as ''~/.ssh/config'', you can add the option "'''ForwardAgent yes'''" to enable the Agent Forwarding without modifying your <code>ssh <host></code> command. For example: | If you use an SSH configuration file for storing common hosts such as ''~/.ssh/config'', you can add the option "'''ForwardAgent yes'''" to enable the Agent Forwarding without modifying your <code>ssh <host></code> command. For example: | ||
<syntaxhighlight lang=bash> | <syntaxhighlight lang="bash"> | ||
Host nx | Host nx | ||
HostName 192.168.0.21 | HostName 192.168.0.21 | ||
Line 79: | Line 79: | ||
And then just run as usual: | And then just run as usual: | ||
<syntaxhighlight lang=bash> | <syntaxhighlight lang="bash"> | ||
ssh nx | ssh nx | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 88: | Line 88: | ||
Once logged into the embedded platform, you can verify that the SSH agent forwarding works by listing the available SSH keys with: | Once logged into the embedded platform, you can verify that the SSH agent forwarding works by listing the available SSH keys with: | ||
<syntaxhighlight lang=bash> | <syntaxhighlight lang="bash"> | ||
ssh-add -l | ssh-add -l | ||
</syntaxhighlight> | </syntaxhighlight> |