On 13.01.16 12:13, Richard W.M. Jones wrote:
On Wed, Jan 13, 2016 at 12:49:19PM +0200, Shahar Havivi wrote:
On 13.01.16 10:27, Richard W.M. Jones wrote:
When you run:
eval `ssh-agent`
I didn't run eval `ssh-agent` but ssh-agnet and then ssh-add (I needed the SSH_AUTH_SOCK that return from ssh-agent since I am running two different processes).
I guess I can read the environment SSH_AUTH_SOCK after run eval `ssh-agent`...
do you think there is a different between running with to without eval?
Yes - very different. If you don't use the eval then no SSH_* environment variables are set. Since I am not running the command in the same shell the environment in the command that run the ssh-agent are not relevant, I do set them when I run the next command ssh-add and later when I run virt-v2v.
Shahar.
What probably happened just after that is you added the key to your X session's ssh-agent -- most desktop session managers start an instance of ssh-agent for you.
Another way to run ssh-agent which may be more appropriate for scripting is:
ssh-agent command args ...
which runs the command straight after and kills ssh-agent when the command ends. It would be tempting to run:
ssh-agent virt-v2v ...
but that won't work because you still have to arrange for the ssh key to be added to virt-v2v's instance of ssh-agent.
Rich.
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW