Failed to connect to query monitoring service

I just upgraded from 39 to 40. Prior to the upgrade any non-root user was able to run “systemd-resolve --statistics” and get useful output. Since the upgrade, only root can run the command. All other users get an error:

Failed to connect to query monitoring service /run/systemd/resolve/io.systemd.Resolve.Monitor: Permission denied

Is this an expected change? Is there some way to permit normal users to run that command again?

thanks

This currently looks like a privileged operation.
It should be possible to resolve with polkit rules in the next systemd release that will probably land in Fedora 42:
resolve: support polkit authentication for io.systemd.Resolve.Monitor · systemd/systemd@cf01bbb · GitHub

You can selectively bypass password authentication like this:

sudo tee /etc/sudoers.d/00-local << EOF > /dev/null
ALL ALL=(ALL) NOPASSWD: $(type -P resolvectl) statistics
EOF
sudo resolvectl statistics

Thanks for the reply. Using sudo is good enough, although I wish this wasn’t necessary, considering how this used to be permitted.

As a side note, sudo syntax requires fully-qualified paths, that $(type -P resolvectl) throws an error msg.

The above code uses an unquoted heredoc delimiter that makes the substitution expand to an absolute path.