How can I configure a KVM guest running CentOS to allow passwordless console access from the hypervisor? I want to be able to use the following command to log straight in to the VM from the hypervisor without it prompting for a password:

virsh console 1

The question is similar to this question, however the server in this case is running CentOS as opposed to Ubuntu, so the tty files and syntax is different.

  • Do you just want to avoid having to enter the password or do you want a running shell (for root?) without even entering the user name? Jan 7 '15 at 20:52
  • @HaukeLaging I would like to be able to type the command and it logs straight in to the VM as root (same functionality as 'vzctl enter ID' on OpenVZ).
    – Chris
    Jan 8 '15 at 13:13

You can possibly use PolicyKit rules to "unlock" libvirt for uids which are members of a specific gid-group. Here is another question, which does that for virt-manager (which like virsh console is based on libvirt).


Specific advice for "unlocking" virsh in this fashion:


Note that, as I understand things, using polkit like this will make all of libvirt (and thus all of virsh) unlocked to uids in the specified gid-group; you might not be able to prevent your guestVM owner from accessing other VMs through virsh and/or virt-manager, in other words.

Caveat: this answer probably allows you to get virsh console to work without a password prompt, but it also may allow other things to work (which you may not want). Insert the usual disclaimers here, about carefully testing your security after attempting any kinds of changes like these; you may be lowering your defenses more than you wanted to.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.