Welcome to the Linux Foundation Forum!

ssh-agent and eval (LAB 5.1)

Hello,

I was wondering why do we run eval $(ssh-agent) before adding the ssh-key ?

Does ssh-agent only displays environment variables that will be assigned with eval ?

Also, why every time I run the ssh-agent command the PID changes ?

The lab is working without executing the mentioned command.

Thanks in advance

Comments

  • LioC
    LioC Posts: 7

    Hi k0dard,

    When doing this lab, I was trying it on several OSes (various Ubuntu and CentOS). Sorry, I cant recall which one, but one of the OS would fail to execute the ssh-add command without running eval $(ssh-agent) . All the others however did not need it.

    As mentioned here:
    https://unix.stackexchange.com/questions/351725/why-eval-the-output-of-ssh-agent

    eval loads the environment variables that were outputed by ssh-agent and that are needed by ssh-add.

    I cant reply more than that though.

    Lionel.

  • k0dard
    k0dard Posts: 115

    Thanks Lionel,

    Great link, everything is clear

  • k0dard
    k0dard Posts: 115

    Also, just to add that I was silly, the PID doesn't change but naturally every time we run eval $(ssh-agent) a new process is started...

Categories

Upcoming Training