Home > Back-end >  ssh-agent command doesn't create env variables as stated in a man page on Ubuntu?
ssh-agent command doesn't create env variables as stated in a man page on Ubuntu?

Time:12-16

When I run ssh-agent it does output to the console:

SSH_AUTH_SOCK=/tmp/ssh-6xVL11wer5lW/agent.311122; export SSH_AUTH_SOCK;
SSH_AGENT_PID=311122; export SSH_AGENT_PID;
echo Agent pid 311122;

However no environmental variables are seen when run env. What is the problem? It does work with:

eval `ssh-agent` && ssh-add

But I wish to understand why cannot I simply use ssh-agent

UPD: On local machine I also have added file /home/user/.ssh/config to replace the need of using ssh-add:

AddKeysToAgent yes

CodePudding user response:

Because the eval statement is mandatory to create those variables.

The command itself just print the variables/values, but are not declaring anything alone. That's the point using eval

  • Related