I ran into this one today while working on a personal project. I had SSH access to a Mac Mini running Big Sur that I didn’t have hooked up to a monitor or keyboard. After digging around, I found I could enable VNC access via these commands.

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resouces/kickstart \
 -activate -configure -access -on \
 -configure -allowAccessFor -allUsers \
 -configure -restart -agent -privs -all

If that doesn’t work, this will set a custom password not tied to any user account:

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart \
-activate -configure -access -on \
-clientopts -setvnclegacy -vnclegacy yes \
-clientopts -setvncpw -vncpw mypasswd \
-restart -agent -privs -all

When you’re done (since you don’t want to leave it enabled 24/7 for security reasons), disable with:

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart \
-deactivate -configure -access -off