How to bypass password prompt with vnc connection from terminal
I've noticed that too but couldn't figure out how to properly pass credentials into VNC either.
The docs for screen sharing say that if both machines are signed into the same iCloud account, then a screen sharing session will begin. Otherwise a username password prompt is displayed. I didn't see much difference between the Catalina and the Big Sur versions of the page unfortunately.
If you want a work around, I hacked together some Apple Script that will open up the screen sharing app, fill in hostname, username/password, then re-enter the password on the remote machine and press enter:
tell application &quot;Screen Sharing&quot;
    activate # start Screen Sharing if not running yet
    tell application &quot;System Events&quot;
        key code 51 using {command down} # Delete whatever is in the textbox
        keystroke &quot;192.168.1.1&quot; # host you want to connect to
        key code 36 # press enter
        delay 1 # wait a moment for the next screen to appear
        keystroke &quot;username&quot; # username
        keystroke tab
        keystroke &quot;hunter2&quot; # password
        key code 36 # press enter
        delay 2 # wait to connect to the target machine
        key code 51 using {command down} # delete anything in the textbox
        keystroke &quot;hunter2&quot; # typing the password on the remote machines textbox
        key code 36 # hitting enter to log in
    end tell
end tell

To use throw the above code into a file called file.scpt and run it via osascript file.scpt. You need to give the Terminal app the Accessibility permission within the Security &amp; Privacy section of the Settings app.