📜  eval ssh-agent (1)

📅  最后修改于: 2023-12-03 15:30:39.301000             🧑  作者: Mango

Introduction to eval ssh-agent

Overview

If you are a programmer and use SSH to connect to remote servers, you must be aware of the pain of typing your passphrase repeatedly for each connection. ssh-agent comes to your rescue by saving your passphrase in memory and only asking it once per session.

However, launching ssh-agent can be tedious. This is where eval ssh-agent comes in handy.

How eval ssh-agent works

eval ssh-agent loads the ssh-agent environment variables into your current shell by executing the output of the command ssh-agent. This means that once you type eval ssh-agent, the environment variables associated with ssh-agent are set up for the current shell.

Here's an example of how to use eval ssh-agent:

$ eval `ssh-agent`
Agent pid 1234
$ ssh-add ~/.ssh/id_rsa
Enter passphrase for /home/user/.ssh/id_rsa:
Identity added: /home/user/.ssh/id_rsa (/home/user/.ssh/id_rsa)
$
Markdown code block
If you are a programmer and use SSH to connect to remote servers, you must be aware of the pain of typing your passphrase repeatedly for each connection. `ssh-agent` comes to your rescue by saving your passphrase in memory and only asking it once per session.

However, launching `ssh-agent` can be tedious. This is where `eval ssh-agent` comes in handy.

`eval ssh-agent` loads the `ssh-agent` environment variables into your current shell by executing the output of the command `ssh-agent`. This means that once you type `eval ssh-agent`, the environment variables associated with `ssh-agent` are set up for the current shell.

Here's an example of how to use `eval ssh-agent`:

$ eval ssh-agent Agent pid 1234 $ ssh-add ~/.ssh/id_rsa Enter passphrase for /home/user/.ssh/id_rsa: Identity added: /home/user/.ssh/id_rsa (/home/user/.ssh/id_rsa) $