Hi guys

Is anybody can help me how to use openAuth to connect a remote URI without input the boring  password? we assume the password of root for remote machine is "123456".

Even I running the example in libvirt library esxlist.py(change uri to a qemu type and assign the username and password).

Bellow is my simple test code, unfortunately it still need me to input the password.

import libvirt

def authcb(ncred, cbdata):
for cred in  ncred:
if cred[0] == libvirt.VIR_CRED_AUTHNAME:
cred[4] = "root"
elif cred == libvirt.VIR_CRED_PASSPHRASE:
cred[4] = "123456"
return 0
class connection:
def __init__(self, uri):
self.uri = uri
def open(self):
auth = [[libvirt.VIR_CRED_AUTHNAME, libvirt.VIR_CRED_PASSPHRASE], authcb, None]
vm_conn =  libvirt.openAuth(self.uri, auth, 0);
print self.uri
if vm_conn == None:
print 'Failed to open connection to %s' % self.uri

for name in vm_conn.listDefinedDomains():
print name
vm = vm_conn.lookupByName(name)

if __name__ == '__main__':
conn = connection('qemu+ssh://root@192.168.1.203/system')
conn.open()
Thanks


fan