How to attach a system-defined libvirt's network to a VM run as a regular user (not sudo) using Cockpit?

Hello.
I want to use cockpit-machines to run VMs but:
-I don’t want my Cockpit’s logged, regular user to be able to escalate privileges:
-I want these VMs to be attached to a virtual bridged network, which is not visible as a regular user
So my question is: Is it possible to attach to virbr1 a VM run as a regular user? If so, how could it be possible? I don’t mind using shell commands if Cockpit doesn’t give the option.

PS: To clarificate…my problem is that is I do sudo virsh net-list I see my network running but if I do vish net-list I don’t see anything

Thanks!!

Does the following help?
permissions - How do I list virsh networks without sudo? - Server Fault, especially permissions - How do I list virsh networks without sudo? - Server Fault

1 Like
sudo virsh net-list --all
sudo virsh net-dumpxml NET_NAME
virsh list --all
virsh attach-interface VM_NAME bridge BR_NAME --model virtio --config --live
2 Likes

Thanks a lot! Provided links and command have been of great help!!
Finally, my problem was that the name I gave to my virtual network in Cockpit wasn’t “default”. It seems VMs created inside Cockpit needs to have this hardcoded name as a attached virtual network. I’ll investigate further and, if so, I’ll open an issue in Cockpit’s github.
Thanks a lot again!!

Sorry, I forgot to mention, for completeness, that my regular user belongs to “libvirt” group. Maybe if it wasn’t like this behaviour would be different (worse)