On 08/06/2014 11:11 AM, Yuanzhen Gu wrote:
> Libvirt is only concerned with what virtual hardware you present
to the
>
> guest, not with the OS running in that guest or what username/password
>
> combinations will let you log into that guest OS. libguestfs may be
>
> able to do some introspection for learning usernames, and also has the
>
> ability to create guest clones where you control the usernames and
>
> passwords to be used in the new guest.
>
>
Thanks! so do you mean that I can use libvirt clone a new guest
with which I can give username and password?
Libvirt can just copy guest storage and hardware configuration. If you
use only libvirt to do a guest clone, then the clone will have the same
OS credentials as the original. That's probably not what you want.
You seem to be asking about libguestfs - but that's a higher-level
application than libvirt, so you may want to migrate your questions to
the libguestfs list.
http://libguestfs.org/virt-sysprep.1.html gives an
overview of the sort of things you can do when prepping a cloned system
via libguestfs, such as setting up a known account with a known password.
but I've no idea where the username and passwd be stored,
create it
with dumpXML of a VM, I've tried that original VM's username and passwd via
ssh, but it didn't work.
Again, libvirt could care less what passwords your guest OS uses, as
passwords are not hardware, so dumpxml is unable to show you that
information(well, you COULD use libvirt's virDomainSetMetadata to store
custom XML that records that information, and then dumpxml would repeat
back the custom XML you associated with the guest - but again, that's
something you do as management, and not something libvirt tracks
natively). Libguestfs knows how to introspect guest file systems, and
may help you create a new password, but if you were careless enough to
lose track of what password an existing guest was using, I seriously
doubt there is anything that we can do to help you recover that
password, at least if it was stored securely by the guest OS.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org