A.19.2.4. 权限已拒绝
- 症状
- 当以非 root 用户身份运行 virsh 命令时,会出现以下错误(或类似):
$ virsh -c qemu://$hostname/system_list error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied error: failed to connect to the hypervisor
- 解决方案
- 编辑
/etc/libvirt/libvirt.conf
文件,并将以下几行添加到文件中:#unix_sock_group = "libvirt" #unix_sock_ro_perms = "0777" #unix_sock_rw_perms = "0770"
- 重启
libvirtd
服务:# systemctl restart libvirtd