How do I force my Mac to log in to an account remotely? It’s possible to restart a Mac from the command line (sudo shutdown -r now). It’s possible to log out from a Mac from the command line (sudo pkill loginwindow). But is it possible to force a Mac to log in from the command line? As in a full log in of an account, GUI-wise, not just logging in via SSH to the Mac via the Terminal.
I created something like this for Remote Desktop to signing a xServe. We had more than 1 account, and we had to sign un with both username and password. I ran this remotely through the terminal to prior to pulling up the screen.
`osascript -e 'tell application &quot;System Events&quot;' -e 'keystroke &quot;USERNAME&quot;' -e 'keystroke tab' -e 'delay 0.5' -e 'keystroke &quot;PASSWORD&quot;' -e 'delay 3.5' -e 'keystroke return' -e 'keystroke return' -e 'end tell'`

Just replace the USERNAME and PASSWORD and that should work.  I have not tested this on a more recent OS, but I hope this helps.