ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Fedora 32: virsh command in a system session without sudo

    IT Discussion
    3
    4
    1.0k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • black3dynamiteB
      black3dynamite
      last edited by

      Even though you are a member of the libvirt group, by default when you run virsh commands without sudo, you are actually in a user session instead of system session.

      To operate in a system session without using sudo, you need to use virsh -c qemu:///system.

      # Running a one-liner virsh commands
      virsh -c qemu:///system list --all
      
      # Entering a virsh interactive terminal
      virsh -c qemu:///system
      
      1 Reply Last reply Reply Quote 2
      • EddieJenningsE
        EddieJennings
        last edited by

        Excellent tip! Just tried this out and it worked.

        black3dynamiteB 1 Reply Last reply Reply Quote 0
        • black3dynamiteB
          black3dynamite @EddieJennings
          last edited by

          @EddieJennings said in Fedora 32: virsh command in a system session without sudo:

          Excellent tip! Just tried this out and it worked.

          If you want to avoid typing -c qemu:///system and make it default when using virsh command, create an alias in your .bashrc file.

          alias virsh="virsh -c qemu:///system"
          
          1 Reply Last reply Reply Quote 0
          • JaredBuschJ
            JaredBusch
            last edited by

            I can see the use for this in a multi user system where you have virtualization admin. They would not need sudo access to do things.

            For most though, just using sudo will suffice.

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post