So, on a vm that has polkit
Open two ssh sessions
Session one, echo $$ to get the pid of your shell
Session two, pkttyagent --process <pid>
Session one, visudo /etc/sudoers.d/rsync
or what ever other command you want as root
Session two, authenticate as the user
You will notice the prompt is the same as the one when you try start/stop/restart/reload a systemd service
Select a user that is allowed in polkit, anyone in admin or sudo should work assuming the default config Session one, your command has executed as root
$ pkttyagent --process 714042
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===
Authentication is needed to run `/usr/sbin/visudo' as the super user
Multiple identities can be used for authentication:
1. <user>
2. <user>
3. <user>
Choose identity to authenticate as (1-3): 3
Password:
==== AUTHENTICATION COMPLETE ===
$ cat /etc/polkit-1/localauthority.conf.d/51-ubuntu-admin.conf
[Configuration]
AdminIdentities=unix-group:sudo;unix-group:admin