Shahar Havivi
2016-Jan-13 07:55 UTC
[Libguestfs] v2v: error while killing ssh-agent after importing VM via xen+ssh
Hi, I am successfully importing VM from Xen server at oVirt project via virt-v2v. I am setting ssh-agent and running ssh-add before the import process, after the import done I am trying to kill the agent via: ssh-agent -k (and setting the SSH_AGENT_PID environment), but I get the following error: kill: No such process Can you please explain why there is no agent? Do I need to delete the agent? btw I am also running 'ssh-add -d' after the import process with no problems. Thank you, Shahar.
Richard W.M. Jones
2016-Jan-13 10:27 UTC
Re: [Libguestfs] v2v: error while killing ssh-agent after importing VM via xen+ssh
On Wed, Jan 13, 2016 at 09:55:53AM +0200, Shahar Havivi wrote:> Hi, > > I am successfully importing VM from Xen server at oVirt project via virt-v2v. > I am setting ssh-agent and running ssh-add before the import process, > after the import done I am trying to kill the agent via: > ssh-agent -k (and setting the SSH_AGENT_PID environment), but I get the > following error: > kill: No such process > > Can you please explain why there is no agent?When you run: eval `ssh-agent` ssh-agent starts up and creates several environment variables (which are added to the environment, because you use the eval `..`). In particular it sets SSH_AGENT_PID to its own PID. ssh-agent -k is supposed to read SSH_AGENT_PID from the environment and kill the previously started ssh-agent process, basically killing that PID. It works for me and for lots of other people, so I'm guessing you must either be running ssh-agent wrongly the first time, or getting the SSH_AGENT_PID environment variable mixed up somewhere.> Do I need to delete the agent?Not necessarily, but if you don't kill the agent then two bad things can happen: (1) You get lots of ssh-agent processes building up (2) The ssh-agent processes may be storing your unencrypted private keys. Except that ...> btw I am also running 'ssh-add -d' after the import process with no problems.... ssh-add -d will remove the private key from the agent. However the agent should still be running after this, so it would have no effect on whether ssh-agent -k would succeed. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/
Shahar Havivi
2016-Jan-13 10:49 UTC
Re: [Libguestfs] v2v: error while killing ssh-agent after importing VM via xen+ssh
On 13.01.16 10:27, Richard W.M. Jones wrote:> On Wed, Jan 13, 2016 at 09:55:53AM +0200, Shahar Havivi wrote: > > Hi, > > > > I am successfully importing VM from Xen server at oVirt project via virt-v2v. > > I am setting ssh-agent and running ssh-add before the import process, > > after the import done I am trying to kill the agent via: > > ssh-agent -k (and setting the SSH_AGENT_PID environment), but I get the > > following error: > > kill: No such process > > > > Can you please explain why there is no agent? > > 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? Shahar.> > ssh-agent starts up and creates several environment variables (which > are added to the environment, because you use the eval `..`). > In particular it sets SSH_AGENT_PID to its own PID. > > ssh-agent -k is supposed to read SSH_AGENT_PID from the environment > and kill the previously started ssh-agent process, basically killing > that PID. > > It works for me and for lots of other people, so I'm guessing you must > either be running ssh-agent wrongly the first time, or getting the > SSH_AGENT_PID environment variable mixed up somewhere. > > > Do I need to delete the agent? > > Not necessarily, but if you don't kill the agent then two bad things > can happen: (1) You get lots of ssh-agent processes building up > (2) The ssh-agent processes may be storing your unencrypted private > keys. Except that ... > > > btw I am also running 'ssh-add -d' after the import process with no problems. > > ... ssh-add -d will remove the private key from the agent. However > the agent should still be running after this, so it would have no > effect on whether ssh-agent -k would succeed. > > Rich. > > -- > Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones > Read my programming and virtualization blog: http://rwmj.wordpress.com > virt-df lists disk usage of guests without needing to install any > software inside the virtual machine. Supports Linux and Windows. > http://people.redhat.com/~rjones/virt-df/
Reasonably Related Threads
- Re: v2v: error while killing ssh-agent after importing VM via xen+ssh
- Re: v2v: error while killing ssh-agent after importing VM via xen+ssh
- Re: v2v: error while killing ssh-agent after importing VM via xen+ssh
- ssh-agent and ssh-add with openssh-2.2.0p1 on Redhat 7
- 2.5.1p1 ssh-agent path problem in Solaris